Dart API Referencedart:ioSocketOutputStream

SocketOutputStream abstract class

SocketOutputStream makes it possible to stream data to a Socket.

abstract class SocketOutputStream implements OutputStream {
  /**
   * Create a [SocketOutputStream] for streaming to a [Socket].
   */
  factory SocketOutputStream(Socket socket) => new _SocketOutputStream(socket);
}

Implements

OutputStream

Constructors

factory SocketOutputStream(Socket socket) #

Create a SocketOutputStream for streaming to a Socket.

factory SocketOutputStream(Socket socket) => new _SocketOutputStream(socket);

Properties

final bool closed #

inherited from OutputStream

Returns whether the stream has been closed by calling close(). If true, no more data may be written to the output stream, but there still may be buffered data that has not been written to the communication channel. The onClosed handler will only be called once all data has been written out.

bool get closed;

void set onClosed(void callback()) #

inherited from OutputStream

Sets the handler that gets called when the underlying communication channel has been closed and all the buffered data has been sent.

void set onClosed(void callback());

void set onError(void callback(e)) #

inherited from OutputStream

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

void set onError(void callback(e));

void set onNoPendingWrites(void callback()) #

inherited from OutputStream

Sets the handler that gets called when the internal OS buffers have been flushed. This callback can be used to keep the rate of writing in sync with the rate the system can write data to the underlying communication channel.

void set onNoPendingWrites(void callback());

Methods

void close() #

inherited from OutputStream

Signal that no more data will be written to the output stream. When all buffered data has been written out to the communication channel, the channel will be closed and the onClosed callback will be called.

void close();

void destroy() #

inherited from OutputStream

Close the communication channel immediately ignoring any buffered data.

void destroy();

void flush() #

inherited from OutputStream

Flushes data from any internal buffers as soon as possible. Note that the actual meaning of calling flush will depend on the actual type of the underlying communication channel.

void flush();

bool write(List<int> buffer, [bool copyBuffer]) #

inherited from OutputStream

Writes the content of buffer to the stream. If copyBuffer is false ownership of the specified buffer is passed to the system and the caller should not change it afterwards. The default value for copyBuffer is true.

Returns true if the data could be written to the underlying communication channel immediately. Otherwise the data is buffered by the output stream and will be sent as soon as possible.

bool write(List<int> buffer, [bool copyBuffer]);

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

inherited from OutputStream

Writes len bytes from buffer buffer starting at offset offset to the output stream. If offset is not specified the default is 0. If len is not specified the default is the length of the buffer minus offset (i.e. writing from offset to the end of the buffer). The system will copy the data to be written so the caller can safely change buffer afterwards.

Returns true if the data could be written to the underlying communication channel immediately. Otherwise the data is buffered by the output stream and will be sent as soon as possible.

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

bool writeString(String string, [Encoding encoding]) #

inherited from OutputStream

Write a string to the stream using the given encoding.The default encoding is UTF-8 - Encoding.UTF_8.

Returns true if the data could be written to the underlying communication channel immediately. Otherwise the data is buffered by the output stream and will be sent as soon as possible.

bool writeString(String string, [Encoding encoding]);