Stream.write()
DESCRIPTION
Write data on a stream. Blocks until all data is written.
When the call returns, the data is only written to the stream, but not necessarily acknowledged by the receiver. This is why it does not make sense to return a number of actual bytes written in case of error since it says nothing about the number of acked bytes. To ensure that written bytes have been acked, a successful call to Stream.close()
is necessary after last call to this Stream.write()
.
DECLARATION
public func write(data: Data) throws
PARAMETERS
data:
- the data to write
THROWS ERRORS
STOPPED:
- if the stream has been closed
OPERATION_IN_PROGRESS:
- if another write operation is already in progress