Creates a new data writer for writing data to the given sink.
The sink to write data to.
Writes all buffered data to the sink. If an incomplete byte is buffered then it is padded with zeroes so the writer points to the beginning of a new byte after flushing.
The buffer size of the writer.
Returns the default encoding of the writer.
the default encoding used when no encoding is specified as parameter to the various string write methods.
Returns the default endianness of the writer.
the default endianness used when no endianness is specified as parameter to the various write methods.
Returns the number of written bytes. This value reflects the number of bytes the writer was told to write so far, not the actual number of written bytes (which may not be finished because writing happens asynchronously). When a write operation fails then this counter is invalid and may not be in sync with the output sink any longer.
the number of written bytes.
Writes an signed 64 bit value.
The value to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an array of signed 64 bit values.
The values to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an unsigned 64 bit value.
The value to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an array of unsigned 64 bit values.
The values to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes a single bit.
The bit to write.
Writes a signed 16 bit value.
The value to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an array of signed 16 bit values.
The values to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes a signed 32 bit value.
The value to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an array of signed 32 bit values.
The values to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes a signed 8 bit value.
The value to write.
Writes an array of signed 8 bit values.
The values to write.
Writes a string.
The text to write.
The encoding. Defaults to encoding the writer was configured with.
Writes an unsigned 16 bit value.
The value to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an array of unsigned 16 bit values.
The values to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an unsigned 32 bit value.
The value to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an array of unsigned 32 bit values.
The values to write.
Optional endianness. Defaults to endianness the writer was configured with.
Writes an unsigned 8 bit value.
The value to write.
Writes an array of unsigned 8 bit values.
The values to write.
Writes all kind of data values to a specified sink.
Written data is buffered so you have to call the flush method when you are done writing all data to ensure that all data is written to the sink.
All methods of the writer are asynchronous but can safely be used synchronously when you have no reason to wait for it. Usually you only want to wait for the flush method at the end of a write operation.