[Serializable] |
ctor #2 | Overloaded:.ctor(Stream output) Initializes a new instance of the BinaryWriter class based on the supplied stream and using UTF-8 as the encoding for strings. |
ctor #3 | Overloaded:.ctor(Stream output, Encoding encoding) Initializes a new instance of the BinaryWriter class based on the supplied stream and a specific character encoding. |
Null | A BinaryWriter with no backing store. |
BaseStream | Read-only Gets the BinaryWriter 's underlying stream. |
Close | Closes the current BinaryWriter and the underlying stream. |
Equals (inherited from System.Object) |
See base class member description: System.Object.Equals Derived from System.Object, the primary base class for all objects. |
Flush | Clears all buffers for the current writer and causes any buffered data to be written to the underlying device. |
GetHashCode (inherited from System.Object) |
See base class member description: System.Object.GetHashCode Derived from System.Object, the primary base class for all objects. |
GetType (inherited from System.Object) |
See base class member description: System.Object.GetType Derived from System.Object, the primary base class for all objects. |
Seek | Sets the position within the current stream. |
ToString (inherited from System.Object) |
See base class member description: System.Object.ToString Derived from System.Object, the primary base class for all objects. |
Write | Overloaded:Write(bool value) Writes a one-byte Boolean value to the current stream, with zero representing false and one representing true. |
Write | Overloaded:Write(byte value) Writes an unsigned byte to the current stream and advances the stream position by one byte. |
Write | Overloaded:Write(byte[] buffer) Writes a byte array to the underlying stream. |
Write | Overloaded:Write(char ch) Writes a Unicode character to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream. |
Write | Overloaded:Write(char[] chars) Writes a character array to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream. |
Write | Overloaded:Write(decimal value) Writes a decimal value to the current stream and advances the stream position by eight bytes. |
Write | Overloaded:Write(double value) Writes an eight-byte floating-point value to the current stream and advances the stream position by eight bytes. |
Write | Overloaded:Write(short value) Writes a two-byte signed integer to the current stream and advances the stream position by two bytes. |
Write | Overloaded:Write(int value) Writes a four-byte signed integer to the current stream and advances the stream position by four bytes. |
Write | Overloaded:Write(long value) Writes an eight-byte signed integer to the current stream and advances the stream position by eight bytes. |
Write | Overloaded:Write(sbyte value) Writes a signed byte to the current stream and advances the stream position by one byte. |
Write | Overloaded:Write(float value) Writes a four-byte floating-point value to the current stream and advances the stream position by four bytes. |
Write | Overloaded:Write(string value) Writes a length-prefixed string to this stream in the current Encoding of the BinaryWriter, and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream. |
Write | Overloaded:Write(ushort value) Writes a two-byte unsigned integer to the current stream and advances the stream position by two bytes. |
Write | Overloaded:Write(uint value) Writes a four-byte unsigned integer to the current stream and advances the stream position by four bytes. |
Write | Overloaded:Write(ulong value) Writes an eight-byte unsigned integer to the current stream and advances the stream position by eight bytes. |
Write | Overloaded:Write(byte[] buffer, int index, int count) Writes a region of a byte array to the current stream. |
Write | Overloaded:Write(char[] chars, int index, int count) Writes a section of a character array to the current stream, and advances the current position of the stream in accordance with the Encoding used and perhaps the specific characters being written to the stream. |
ctor #1 | Overloaded:.ctor() Default constructor. This constructor is called by derived class constructors to initialize state in this type.Initializes a new instance of the BinaryWriter class that writes to a stream. |
OutStream | Holds the underlying stream. |
Dispose | Releases the unmanaged resources used by the BinaryWriter and optionally releases the managed resources. |
Finalize (inherited from System.Object) |
See base class member description: System.Object.Finalize Derived from System.Object, the primary base class for all objects. |
MemberwiseClone (inherited from System.Object) |
See base class member description: System.Object.MemberwiseClone Derived from System.Object, the primary base class for all objects. |
Write7BitEncodedInt | Writes a 32-bit integer in a compressed format. |
Hierarchy:
protected BinaryWriter(); |
public BinaryWriter( |
output
Exception Type | Condition |
---|---|
ArgumentException | The stream does not support writing, or the stream is already closed. |
ArgumentNullException | output is null. |
output
encoding
Exception Type | Condition |
---|---|
ArgumentException | The stream does not support writing, or the stream is already closed. |
ArgumentNullException | output or encoding is null. |
public static readonly BinaryWriter Null;
|
protected Stream OutStream;
|
public virtual Stream BaseStream {get;}
|
public virtual void Close(); |
Flushing the stream will not flush its underlying encoder unless you explicitly call BinaryWriter.Flush or Close. Setting StreamWriter.AutoFlush to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.
protected virtual void Dispose( |
disposing
~BinaryWriter(); |
public virtual void Flush(); |
Flushing the stream will not flush its underlying encoder unless you explicitly call Flush or BinaryWriter.Close. Setting StreamWriter.AutoFlush to true means that data will be flushed from the buffer to the stream, but the encoder state will not be flushed. This allows the encoder to keep its state (partial characters) so that it can encode the next block of characters correctly. This scenario affects UTF8 and UTF7 where certain characters can only be encoded after the encoder receives the adjacent character or characters.
public virtual int GetHashCode(); |
public Type GetType(); |
protected object MemberwiseClone(); |
public virtual long Seek(int offset, Seek( |
offset
origin
public virtual string ToString(); |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
buffer
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
ArgumentNullException | buffer is null. |
public virtual void Write( |
ch
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
chars
Exception Type | Condition |
---|---|
ArgumentNullException | chars is null. |
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
[CLSCompliant(false)] |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
public virtual void Write( |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
ArgumentNullException | value is null. |
[CLSCompliant(false)] |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
[CLSCompliant(false)] |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
[CLSCompliant(false)] |
value
Exception Type | Condition |
---|---|
IOException | An I/O error occurs, such as the stream being closed. |
buffer
index
count
Exception Type | Condition |
---|---|
ArgumentException | The buffer length minus index is less than count. |
ArgumentNullException | buffer is null. |
ArgumentOutOfRangeException | index or count is negative. |
IOException | An I/O error occurs, such as the stream being closed. |
chars
index
count
Exception Type | Condition |
---|---|
ArgumentException | The buffer length minus index is less than count. |
ArgumentNullException | chars is null. |
ArgumentOutOfRangeException | index or count is negative. |
IOException | An I/O error occurs, such as the stream being closed. |
protected void Write7BitEncodedInt( |
value
Exception Type | Condition |
---|---|
EndOfStreamException | The end of the stream is reached. |
IOException | The stream is closed. |
If value will fit in seven bits, it takes only one byte of space. If value will not fit in seven bits, the high bit is set on the first byte and written out.value is then shifted by seven bits and the next byte is written. This process is repeated until the entire integer has been written.