C# Class MiscUtil.IO.EndianBinaryWriter

Equivalent of System.IO.BinaryWriter, but with either endianness, depending on the EndianBitConverter it is constructed with.
Inheritance: IDisposable
ファイルを表示 Open project: jadref/buffer_bci Class Usage Examples

Public Methods

Method Description
Close ( ) : void

Closes the writer, including the underlying stream.

Dispose ( ) : void

Disposes of the underlying stream.

EndianBinaryWriter ( EndianBitConverter bitConverter, Stream stream ) : System

Constructs a new binary writer with the given bit converter, writing to the given stream, using UTF-8 encoding.

EndianBinaryWriter ( EndianBitConverter bitConverter, Stream stream, Encoding encoding ) : System

Constructs a new binary writer with the given bit converter, writing to the given stream, using the given encoding.

Flush ( ) : void

Flushes the underlying stream.

Seek ( int offset, SeekOrigin origin ) : void

Seeks within the stream.

Write ( bool value ) : void

Writes a boolean value to the stream. 1 byte is written.

Write ( byte value ) : void

Writes a signed byte to the stream.

Write ( byte value, int offset, int count ) : void

Writes a portion of an array of bytes to the stream.

Write ( char value ) : void

Writes a single character to the stream, using the encoding for this writer.

Write ( decimal value ) : void

Writes a decimal value to the stream, using the bit converter for this writer. 16 bytes are written.

Write ( double value ) : void

Writes a double-precision floating-point value to the stream, using the bit converter for this writer. 8 bytes are written.

Write ( float value ) : void

Writes a single-precision floating-point value to the stream, using the bit converter for this writer. 4 bytes are written.

Write ( int value ) : void

Writes a 32-bit signed integer to the stream, using the bit converter for this writer. 4 bytes are written.

Write ( long value ) : void

Writes a 64-bit signed integer to the stream, using the bit converter for this writer. 8 bytes are written.

Write ( sbyte value ) : void

Writes an unsigned byte to the stream.

Write ( short value ) : void

Writes a 16-bit signed integer to the stream, using the bit converter for this writer. 2 bytes are written.

Write ( string value ) : void

Writes a string to the stream, using the encoding for this writer.

Write ( uint value ) : void

Writes a 32-bit unsigned integer to the stream, using the bit converter for this writer. 4 bytes are written.

Write ( ulong value ) : void

Writes a 64-bit unsigned integer to the stream, using the bit converter for this writer. 8 bytes are written.

Write ( ushort value ) : void

Writes a 16-bit unsigned integer to the stream, using the bit converter for this writer. 2 bytes are written.

Write7BitEncodedInt ( int value ) : void

Writes a 7-bit encoded integer from the stream. This is stored with the least significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag.

Private Methods

Method Description
CheckDisposed ( ) : void

Checks whether or not the writer has been disposed, throwing an exception if so.

WriteInternal ( byte bytes, int length ) : void

Writes the specified number of bytes from the start of the given byte array, after checking whether or not the writer has been disposed.

Method Details

Close() public method

Closes the writer, including the underlying stream.
public Close ( ) : void
return void

Dispose() public method

Disposes of the underlying stream.
public Dispose ( ) : void
return void

EndianBinaryWriter() public method

Constructs a new binary writer with the given bit converter, writing to the given stream, using UTF-8 encoding.
public EndianBinaryWriter ( EndianBitConverter bitConverter, Stream stream ) : System
bitConverter MiscUtil.Conversion.EndianBitConverter Converter to use when writing data
stream Stream Stream to write data to
return System

EndianBinaryWriter() public method

Constructs a new binary writer with the given bit converter, writing to the given stream, using the given encoding.
public EndianBinaryWriter ( EndianBitConverter bitConverter, Stream stream, Encoding encoding ) : System
bitConverter MiscUtil.Conversion.EndianBitConverter Converter to use when writing data
stream Stream Stream to write data to
encoding System.Text.Encoding Encoding to use when writing character data
return System

Flush() public method

Flushes the underlying stream.
public Flush ( ) : void
return void

Seek() public method

Seeks within the stream.
public Seek ( int offset, SeekOrigin origin ) : void
offset int Offset to seek to.
origin SeekOrigin Origin of seek operation.
return void

Write() public method

Writes a boolean value to the stream. 1 byte is written.
public Write ( bool value ) : void
value bool The value to write
return void

Write() public method

Writes a signed byte to the stream.
public Write ( byte value ) : void
value byte The value to write
return void

Write() public method

Writes a portion of an array of bytes to the stream.
public Write ( byte value, int offset, int count ) : void
value byte An array containing the bytes to write
offset int The index of the first byte to write within the array
count int The number of bytes to write
return void

Write() public method

Writes a single character to the stream, using the encoding for this writer.
public Write ( char value ) : void
value char The value to write
return void

Write() public method

Writes a decimal value to the stream, using the bit converter for this writer. 16 bytes are written.
public Write ( decimal value ) : void
value decimal The value to write
return void

Write() public method

Writes a double-precision floating-point value to the stream, using the bit converter for this writer. 8 bytes are written.
public Write ( double value ) : void
value double The value to write
return void

Write() public method

Writes a single-precision floating-point value to the stream, using the bit converter for this writer. 4 bytes are written.
public Write ( float value ) : void
value float The value to write
return void

Write() public method

Writes a 32-bit signed integer to the stream, using the bit converter for this writer. 4 bytes are written.
public Write ( int value ) : void
value int The value to write
return void

Write() public method

Writes a 64-bit signed integer to the stream, using the bit converter for this writer. 8 bytes are written.
public Write ( long value ) : void
value long The value to write
return void

Write() public method

Writes an unsigned byte to the stream.
public Write ( sbyte value ) : void
value sbyte The value to write
return void

Write() public method

Writes a 16-bit signed integer to the stream, using the bit converter for this writer. 2 bytes are written.
public Write ( short value ) : void
value short The value to write
return void

Write() public method

Writes a string to the stream, using the encoding for this writer.
value is null
public Write ( string value ) : void
value string The value to write. Must not be null.
return void

Write() public method

Writes a 32-bit unsigned integer to the stream, using the bit converter for this writer. 4 bytes are written.
public Write ( uint value ) : void
value uint The value to write
return void

Write() public method

Writes a 64-bit unsigned integer to the stream, using the bit converter for this writer. 8 bytes are written.
public Write ( ulong value ) : void
value ulong The value to write
return void

Write() public method

Writes a 16-bit unsigned integer to the stream, using the bit converter for this writer. 2 bytes are written.
public Write ( ushort value ) : void
value ushort The value to write
return void

Write7BitEncodedInt() public method

Writes a 7-bit encoded integer from the stream. This is stored with the least significant information first, with 7 bits of information per byte of value, and the top bit as a continuation flag.
public Write7BitEncodedInt ( int value ) : void
value int The 7-bit encoded integer to write to the stream
return void