Dart API Referencedart:ioListInputStream

ListInputStream abstract class

ListInputStream makes it possible to use the InputStream interface to stream over data that is received in chunks as lists of integers.

When a new list of integers is received it can be written to the ListInputStream using the write method. The markEndOfStream method must be called when the last data has been written to the ListInputStream.

abstract class ListInputStream implements InputStream {
  /**
   * Create an empty [ListInputStream] to which data can be written
   * using the [write] method.
   */
  factory ListInputStream() =>  new _ListInputStream();

  /**
   * Write more data to be streamed over to the [ListInputStream].
   */
  void write(List<int> data);

  /**
   * Notify the [ListInputStream] that no more data will be written to
   * it.
   */
  void markEndOfStream();
}

Implements

InputStream

Constructors

factory ListInputStream() #

Create an empty ListInputStream to which data can be written using the write method.

factory ListInputStream() =>  new _ListInputStream();

Properties

final bool closed #

inherited from InputStream

Returns whether the stream is closed. There will be no more data to read.

bool get closed;

void set onClosed(void callback()) #

inherited from InputStream

Sets the handler that gets called when there will be no more data available in the stream.

void set onClosed(void callback());

void set onData(void callback()) #

inherited from InputStream

Sets the handler that gets called when data is available.

void set onData(void callback());

void set onError(void callback(e)) #

inherited from InputStream

Sets the handler that gets called when the underlying communication channel gets into some kind of error situation.

void set onError(void callback(e));

Methods

int available() #

inherited from InputStream

Returns the number of bytes available for immediate reading.

int available();

void close() #

inherited from InputStream

Close the underlying communication channel to avoid getting any more data. In normal situations, where all data is read from the stream until the close handler is called, calling close is not required. When close is used the close handler will still be called.

void close();

void markEndOfStream() #

Notify the ListInputStream that no more data will be written to it.

void markEndOfStream();

void pipe(OutputStream output, [bool close = true]) #

inherited from InputStream

Pipe the content of this input stream directly to the output stream output. The default behavior is to close the output when all the data from the input stream have been written. Specifying false for the optional argument close keeps the output stream open after writing all data from the input stream.

void pipe(OutputStream output, [bool close = true]);

List<int> read([int len]) #

inherited from InputStream

Reads data from the stream. Returns a system allocated buffer with up to len bytes. If no value is passed for len all available data will be returned. If no data is available null will be returned.

List<int> read([int len]);

int readInto(List<int> buffer, [int offset, int len]) #

inherited from InputStream

Reads up to len bytes into buffer buffer starting at offset offset. Returns the number of bytes actually read which might be zero. If offset is not specified 0 is used. If len is not specified the length of buffer is used.

int readInto(List<int> buffer, [int offset, int len]);

void write(List<int> data) #

Write more data to be streamed over to the ListInputStream.

void write(List<int> data);