public class BinaryWriter extends java.lang.Object implements IDisposable
Modifier and Type | Field and Description |
---|---|
static BinaryWriter |
Null |
protected Stream |
OutStream |
Modifier | Constructor and Description |
---|---|
protected |
BinaryWriter()
Initializes a new instance of the System.IO.BinaryWriter class that writes to a stream.
|
|
BinaryWriter(Stream output)
Initializes a new instance of the System.IO.BinaryWriter class based on the supplied stream and using UTF-8 as the encoding for strings.
|
|
BinaryWriter(Stream output,
java.lang.String encoding)
Initializes a new instance of the System.IO.BinaryWriter class based on the supplied stream and a specific character encoding.
|
Modifier and Type | Method and Description |
---|---|
void |
Close()
Closes the current System.IO.BinaryWriter and the underlying stream.
|
void |
Dispose()
Releases the resources used by the current instance of the System.IO.BinaryWriter class.
|
protected void |
Dispose(boolean disposing)
Called by the System.IO.BinaryWriter.Dispose method and finalizer to release the managed and unmanaged resources used by the current instance of the System.IO.BinaryWriter class.
|
void |
Flush()
Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.
|
Stream |
getBaseStream()
Gets the underlying stream of the System.IO.BinaryWriter.
|
void |
Write(boolean value)
Writes a one-byte Boolean value to the current stream, with 0 representing false and 1 representing true.
|
void |
Write(byte value)
Writes a signed byte to the current stream and advances the stream position by one byte.
|
void |
Write(byte[] buffer)
Writes a byte array to the underlying stream.
|
void |
Write(int value)
Writes a four-byte signed integer to the current stream and advances the stream position by four bytes.
|
void |
Write(long value)
Writes an eight-byte signed integer to the current stream and advances the stream position by eight bytes.
|
void |
Write(short value)
Writes a two-byte signed integer to the current stream and advances the stream position by two bytes.
|
void |
Write(java.lang.String value)
Writes a length-prefixed string to this stream in the current encoding of the System.IO.BinaryWriter, and advances the current position of the stream in accordance with the encoding used and the specific characters being written to the stream.
|
public static final BinaryWriter Null
protected Stream OutStream
protected BinaryWriter()
public BinaryWriter(Stream output)
output
- The output stream.public BinaryWriter(Stream output, java.lang.String encoding)
output
- The output stream.encoding
- The character encoding to use.public Stream getBaseStream()
public void Close()
public void Dispose()
Dispose
in interface IDisposable
protected void Dispose(boolean disposing)
disposing
- true to release managed and unmanaged resources; false to release only unmanaged resources.public void Flush()
public void Write(boolean value)
value
- The Boolean value to write (0 or 1).public void Write(byte value)
value
- The signed byte to write.public void Write(byte[] buffer)
buffer
- A byte array containing the data to write.public void Write(short value)
value
- The two-byte signed integer to write.public void Write(int value)
value
- The four-byte signed integer to write.public void Write(long value)
value
- The eight-byte signed integer to write.public void Write(java.lang.String value)
value
- The value to write.