Dart API Referencedart:ioSocketInputStream

SocketInputStream abstract class

SocketInputStream makes it possible to stream over data received from a Socket.

abstract class SocketInputStream implements InputStream {
  /**
   * Create a [SocketInputStream] for streaming from a [Socket].
   */
  factory SocketInputStream(Socket socket) => new _SocketInputStream(socket);
}

Implements

InputStream

Constructors

factory SocketInputStream(Socket socket) #

Create a SocketInputStream for streaming from a Socket.

factory SocketInputStream(Socket socket) => new _SocketInputStream(socket);

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 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]);