The #close()
operation should be idempotent.
The #close()
operation should be idempotent. It should be no problem with closing the same object twice.
The close operation should cancel the current operation if possible. The close should throw exception only
in serious cases (for example in case of data loss, or inconsistent data)
a promise that resolves when object finishes closing
Flush as much data from buffers as possible.
Flush as much data from buffers as possible. Note that some data could remain in the buffers if it could
not be readily converted (for example, incomplete code points in internal character buffer for
net.sf.asyncobjects.nio.text.EncoderOutput
).
a promise that resolves when data finishes flushing
Write data to stream.
Write data to stream. Note that the data will be written completely. If data could not be completely processed, it should be saved in stream's buffer.
a buffer with data to write
a promise that resolves when data finished writing
A output stream