Skip to content

Problem with InputStream interface read #199

Closed
@DartBot

Description

@DartBot

This issue was originally filed by [email protected]


Current inputstream interface:


interface InputStream {
  /**
   * Reads [len] bytes into [buffer] buffer starting at [offset] offset.
   * [callback] callback is invoked on completion unless it is null.
   */
  bool read(List<int> buffer, int offset, int len, void callback());

  /**
   * Reads data from the stream into a buffer until a given [pattern] occurs and
   * hands that buffer over as an input to the registered [callback].
   * The callback is not invoked if a read error occurs.
   */
  void readUntil(List<int> pattern, void callback(List<int> buffer));
}


In an example I'm doing a file read, and this is seems odd to me.

* This is an async operation - what does the return bool mean?

* The callback should take a parameter (int numBytesRead).

I suppose there is a dual in outputstream.

/Karl

Metadata

Metadata

Assignees

Labels

area-core-librarySDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions