Initializes a new instance of the BinaryWriter class based on the specified IFile instance and character encoding, and optionally leaves the file open.
The output file, expecting an IFile instance.
The character encoding to use, or an object implementing the IEncoding interface. Default to 'utf8'
true
to leave the file open after the BinaryWriter object is disposed; otherwise, false
.
Returns the file associated with the writer. It flushes all pending writes before returning. All subclasses should override flush to ensure that all buffered data is sent to the file.
Get a BinaryWriter instance with no backing store.
Closes this writer and releases any system resources associated with the writer. Following a call to Close, any operations on the writer may raise exceptions.
Clears all buffers for this writer and causes any buffered data to be written to the underlying device.
Writes a 32-bit integer in a compressed format.
The 32-bit integer to be written.
Writes a 64-bit integer in a compressed format.
The 64-bit integer to be written.
Writes a one-byte Boolean value to the current file, with 0
representing false
and 1
representing true
.
The Boolean value to write (0
or 1
).
Writes a byte array to the underlying file.
A byte array containing the data to write.
Writes a region of a byte array to the current file.
A byte array containing the data to write.
The index of the first byte to read from buffer
and to write to the file.
The number of bytes to read from buffer
and to write to the file.
Writes an unsigned byte to the current file and advances the file position by one byte.
The unsigned byte to write.
Write a null-terminated string to this file in the current encoding of the BinaryWriter, and advances the current position of the file in accordance with the encoding used and the specific characters being written to the file.
The value to write.
Writes a Unicode character to the current file and advances the current position of the file in accordance with the Encoding used and the specific characters being written to the file.
The non-surrogate, Unicode character to write.
Writes a character array to the current file and advances the current position of the file in accordance with the Encoding used and the specific characters being written to the file.
A character array containing the data to write.
Writes a section of a character array to the current file, and advances the current position of the file in accordance with the Encoding used and perhaps the specific characters being written to the file.
A character array containing the data to write.
The index of the first character to read from chars
and to write to the stream.
The number of characters to read from chars
and to write to the stream.
Writes an eight-byte floating-point value to the current file and advances the file position by eight bytes.
The eight-byte floating-point value to write.
Writes a two-byte signed integer to the current file and advances the file position by two bytes.
The two-byte signed integer to write.
Writes a four-byte signed integer to the current file and advances the file position by four bytes.
The four-byte signed integer to write.
Writes an eight-byte signed integer to the current file and advances the file position by eight bytes.
The eight-byte signed integer to write.
Write a plain string to this file in the current encoding of the BinaryWriter, and advances the current position of the file in accordance with the encoding used and the specific characters being written to the file.
The value to write.
Writes a signed byte to the current file and advances the file position by one byte.
Writes a four-byte floating-point value to the current file and advances the file position by four bytes.
The four-byte floating-point value to write.
Writes a length-prefixed string to this file in the current encoding of the BinaryWriter, and advances the current position of the file in accordance with the encoding used and the specific characters being written to the file.
The value to write.
Writes a two-byte unsigned integer to the current file and advances the file position by two bytes.
The two-byte unsigned integer to write.
Writes a four-byte unsigned integer to the current file and advances the file position by four bytes.
The four-byte unsigned integer to write.
Writes an eight-byte unsigned integer to the current file and advances the file position by eight bytes.
The eight-byte unsigned integer to write.
Generated using TypeDoc
Writes primitive types in binary to a file and supports writing strings in a specific encoding.