C# Класс MiscUtil.IO.EndianBinaryWriter

Equivalent of System.IO.BinaryWriter, but with either endianness, depending on the EndianBitConverter it is constructed with.
Наследование: IDisposable
Показать файл Открыть проект Примеры использования класса

Открытые методы

Метод Описание
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.

Приватные методы

Метод Описание
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.

Описание методов

Close() публичный Метод

Closes the writer, including the underlying stream.
public Close ( ) : void
Результат void

Dispose() публичный Метод

Disposes of the underlying stream.
public Dispose ( ) : void
Результат void

EndianBinaryWriter() публичный Метод

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
Результат System

EndianBinaryWriter() публичный Метод

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
Результат System

Flush() публичный Метод

Flushes the underlying stream.
public Flush ( ) : void
Результат void

Seek() публичный Метод

Seeks within the stream.
public Seek ( int offset, SeekOrigin origin ) : void
offset int Offset to seek to.
origin SeekOrigin Origin of seek operation.
Результат void

Write() публичный Метод

Writes a boolean value to the stream. 1 byte is written.
public Write ( bool value ) : void
value bool The value to write
Результат void

Write() публичный Метод

Writes a signed byte to the stream.
public Write ( byte value ) : void
value byte The value to write
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

Writes a single character to the stream, using the encoding for this writer.
public Write ( char value ) : void
value char The value to write
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

Writes an unsigned byte to the stream.
public Write ( sbyte value ) : void
value sbyte The value to write
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

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.
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

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
Результат void

Write() публичный Метод

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
Результат void

Write7BitEncodedInt() публичный Метод

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
Результат void