PeterO.BinaryIO
PeterO.BinaryIO
public sealed class BinaryIO
Reads and writes data types in little endian or big endian.
Member Summary
CanRead
- Gets a value indicating whether the underlying stream can be read.CanSeek
- Gets a value indicating whether the underlying stream supports seeking.CanWrite
- Gets a value indicating whether the underlying stream supports writing.Length
- Gets the length of the underlying stream.Position
- Gets or sets the position of the underlying stream.Read(byte[], int, int)
- Not documented yet.Read7BitEncodedInt32BE()
- Not documented yet.Read7BitEncodedInt32LE()
- Reads a signed 32-bit integer encoded in 7-bit encoding to the stream.Read7BitEncodedInt64BE()
- Not documented yet.Read7BitEncodedInt64LE()
- Not documented yet.Read7BitEncodedUInt32BE()
- Not documented yet.Read7BitEncodedUInt32LE()
- Reads an unsigned 32-bit integer encoded in 7-bit encoding to the stream.ReadByte()
- Not documented yet.ReadBytes(int)
- Reads data from a stream into a byte array.ReadDoubleBE()
- Reads a 64-bit floating-point number in big-endian byte order.ReadDoubleLE()
- Not documented yet.ReadInt16BE()
- Reads a 16-bit signed integer in big-endian byte order (2 bytes).ReadInt16LE()
- Not documented yet.ReadInt32BE()
- Reads a 32-bit signed integer in big-endian byte order (4 bytes).ReadInt32LE()
- Not documented yet.ReadInt64BE()
- Reads a 64-bit signed integer in big-endian byte order (8 bytes).ReadInt64LE()
- Not documented yet.ReadSingleBE()
- Not documented yet.ReadSingleLE()
- Not documented yet.Write(byte[])
- Not documented yet.Write(byte[], int, int)
- Not documented yet.Write7BitEncodedInt32BE(int)
- Not documented yet.Write7BitEncodedInt32LE(int)
- Not documented yet.Write7BitEncodedInt64BE(long)
- Not documented yet.Write7BitEncodedInt64LE(long)
- Not documented yet.Write7BitEncodedUInt32BE(int)
- Not documented yet.Write7BitEncodedUInt32LE(int)
- Not documented yet.WriteBE(byte)
- Not documented yet.WriteBE(double)
- Not documented yet.WriteBE(float)
- Not documented yet.WriteBE(int)
- Not documented yet.WriteBE(long)
- Not documented yet.WriteBE(short)
- Not documented yet.WriteLE(byte)
- Not documented yet.WriteLE(double)
- Not documented yet.WriteLE(float)
- Not documented yet.WriteLE(int)
- Not documented yet.WriteLE(long)
- Not documented yet.WriteLE(short)
- Not documented yet.
BinaryIO Constructor
public BinaryIO( System.IO.Stream stream);
Initializes a new instance of the PeterO.BinaryIO class. Initializes a new BinaryIO instance.
Parameters:
- stream: The parameter stream is a Stream object.
Exceptions:
- System.ArgumentNullException: The parameter stream is null.
CanRead
public bool CanRead { get; }
Gets a value indicating whether the underlying stream can be read. Returns:
true
if the underlying stream can be read; otherwise, false
.
CanSeek
public bool CanSeek { get; }
Gets a value indicating whether the underlying stream supports seeking. Returns:
true
if the underlying stream supports seeking; otherwise, false
.
CanWrite
public bool CanWrite { get; }
Gets a value indicating whether the underlying stream supports writing. Returns:
true
if the underlying stream supports writing; otherwise, false
.
Length
public long Length { get; }
Gets the length of the underlying stream. Returns:
The length of the underlying stream.
Position
public long Position { get; set; }
Gets or sets the position of the underlying stream. Returns:
The position of the underlying stream.
Read
public int Read( byte[] data, int offset, int length);
Not documented yet.
Parameters:
data: The parameter data is not documented yet.
offset: A zero-based index showing where the desired portion of data begins.
length: The number of elements in the desired portion of data (but not more than data 's length).
Return Value:
A 32-bit signed integer.
Exceptions:
T:System.ArgumentException: Either offset or length is less than 0 or greater than data 's length, or data ' s length minus offset is less than length .
System.ArgumentNullException: The parameter data is null.
System.ArgumentException: Either "offset" or "length" is less than 0 or greater than "data"'s length, or "data"'s length minus "offset" is less than "length".
Read7BitEncodedInt32BE
public int Read7BitEncodedInt32BE();
Not documented yet.
Return Value:
A 32-bit signed integer.
Read7BitEncodedInt32LE
public int Read7BitEncodedInt32LE();
Reads a signed 32-bit integer encoded in 7-bit encoding to the stream. In 7-bit encoding, an integer is encoded in one or more bytes. Each byte contains 7 bits of the result, starting with the least-significant bits. If the eighth (highest) bit is 1, then the byte that follows it contains 7 more bits, and so on. Otherwise, the process stops and the resulting integer is returned. The return value of this method can be up to 32 bits long. If bit 32 is 1, the return value is negative; otherwise positive.
Return Value:
A 32-bit signed integer.
Read7BitEncodedInt64BE
public long Read7BitEncodedInt64BE();
Not documented yet.
Return Value:
A 64-bit signed integer.
Read7BitEncodedInt64LE
public long Read7BitEncodedInt64LE();
Not documented yet.
Return Value:
A 64-bit signed integer.
Read7BitEncodedUInt32BE
public int Read7BitEncodedUInt32BE();
Not documented yet.
Return Value:
A 32-bit signed integer.
Read7BitEncodedUInt32LE
public int Read7BitEncodedUInt32LE();
Reads an unsigned 32-bit integer encoded in 7-bit encoding to the stream. In 7-bit encoding, an integer is encoded in one or more bytes. Each byte contains 7 bits of the result, starting with the least-significant bits. If the eighth (highest) bit is 1, then the byte that follows it contains 7 more bits, and so on. Otherwise, the process stops and the resulting integer is returned. The return value of this method can be up to 31 bits long and is positive.
Return Value:
A 32-bit signed integer.
ReadByte
public byte ReadByte();
Not documented yet.
Return Value:
A byte (from 0 to 255).
ReadBytes
public byte[] ReadBytes( int size);
Reads data from a stream into a byte array.
Parameters:
- size: The parameter size is not documented yet.
Return Value:
A byte array containing the data read.
ReadDoubleBE
public double ReadDoubleBE();
Reads a 64-bit floating-point number in big-endian byte order.
Return Value:
A 64-bit floating-point number.
ReadDoubleLE
public double ReadDoubleLE();
Not documented yet.
Return Value:
A 64-bit floating-point number.
ReadInt16BE
public short ReadInt16BE();
Reads a 16-bit signed integer in big-endian byte order (2 bytes).
Return Value:
A 16-bit signed integer.
ReadInt16LE
public short ReadInt16LE();
Not documented yet.
Return Value:
A 16-bit signed integer.
ReadInt32BE
public int ReadInt32BE();
Reads a 32-bit signed integer in big-endian byte order (4 bytes).
Return Value:
A 32-bit signed integer.
ReadInt32LE
public int ReadInt32LE();
Not documented yet.
Return Value:
A 32-bit signed integer.
ReadInt64BE
public long ReadInt64BE();
Reads a 64-bit signed integer in big-endian byte order (8 bytes).
Return Value:
A 64-bit signed integer.
ReadInt64LE
public long ReadInt64LE();
Not documented yet.
Return Value:
A 64-bit signed integer.
ReadSingleBE
public float ReadSingleBE();
Not documented yet.
Return Value:
A 32-bit floating-point number.
ReadSingleLE
public float ReadSingleLE();
Not documented yet.
Return Value:
A 32-bit floating-point number.
Write
public void Write( byte value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
Write
public void Write( byte[] data);
Not documented yet.
Parameters:
- data: The parameter data is not documented yet.
Exceptions:
- System.ArgumentNullException: The parameter data is null.
Write
public void Write( byte[] data, int offset, int length);
Not documented yet.
Parameters:
data: The parameter data is not documented yet.
offset: A zero-based index showing where the desired portion of data begins.
length: The number of elements in the desired portion of data (but not more than data 's length).
Exceptions:
System.ArgumentException: Either offset or length is less than 0 or greater than data 's length, or data ' s length minus offset is less than length .
System.ArgumentNullException: The parameter data is null.
Write7BitEncodedInt32BE
public int Write7BitEncodedInt32BE( int value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
Return Value:
A 32-bit signed integer.
Write7BitEncodedInt32LE
public int Write7BitEncodedInt32LE( int value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
Return Value:
A 32-bit signed integer.
Write7BitEncodedInt64BE
public int Write7BitEncodedInt64BE( long value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
Return Value:
A 32-bit signed integer.
Write7BitEncodedInt64LE
public int Write7BitEncodedInt64LE( long value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
Return Value:
A 32-bit signed integer.
Write7BitEncodedUInt32BE
public int Write7BitEncodedUInt32BE( int value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
Return Value:
A 32-bit signed integer.
Write7BitEncodedUInt32LE
public int Write7BitEncodedUInt32LE( int value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
Return Value:
A 32-bit signed integer.
WriteBE
public void WriteBE( byte value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteBE
public void WriteBE( double value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteBE
public void WriteBE( float value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteBE
public void WriteBE( int value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteBE
public void WriteBE( long value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteBE
public void WriteBE( short value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteLE
public void WriteLE( byte value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteLE
public void WriteLE( double value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteLE
public void WriteLE( float value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteLE
public void WriteLE( int value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteLE
public void WriteLE( long value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.
WriteLE
public void WriteLE( short value);
Not documented yet.
Parameters:
- value: The parameter value is not documented yet.