Table of Contents

Class FlexibleBinaryReader

Namespace
PushTechnology.ClientInterface.IO
Assembly
Diffusion.Client.dll

The binary reader that is able to read basic data types from a byte stream.

public sealed class FlexibleBinaryReader
Inheritance
FlexibleBinaryReader
Inherited Members

Constructors

FlexibleBinaryReader(Stream, ByteOrder)

Creates a new FlexibleBinaryReader that will be able to read basic data types from the given byte stream.

public FlexibleBinaryReader(Stream inputStream, ByteOrder valueByteOrder)

Parameters

inputStream Stream

The byte stream to read from.

valueByteOrder ByteOrder

The byte order to use for all reading operations.

Remarks

The reader does not take ownership of the given inputStream. The stream needs to be disposed of if it is no longer needed.

Exceptions

ArgumentNullException

The given stream is null.

ArgumentException

The given stream does not support reading.

Properties

BaseStream

Returns the underlying stream.

public Stream BaseStream { get; }

Property Value

Stream

The underlying stream.

ByteOrder

Returns the byte order the reader operates in.

public ByteOrder ByteOrder { get; }

Property Value

ByteOrder

The byte order the reader operates in.

IsEndOfStream

Returns true if the reader has reached the end of the stream.

public bool IsEndOfStream { get; }

Property Value

bool

Whether the reader has reached the end of the stream.

Methods

Read(byte[], int, int)

Reads the specified number of bytes from the current byte stream position.

public void Read(byte[] outputBuffer, int offset, int length)

Parameters

outputBuffer byte[]

The buffer to read data into.

offset int

The starting index of the output buffer.

length int

The number of bytes to read.

Exceptions

ArgumentNullException

The given buffer is null.

ArgumentOutOfRangeException

The given offset or length are negative or bigger than the given buffer.

EndOfStreamException

The stream has reached the end before finishing the operation.

Read(int)

Reads the specified number of bytes from the current byte stream position.

public byte[] Read(int length)

Parameters

length int

The number of bytes to read.

Returns

byte[]

The byte array containing the data that has been read from the input stream.

Exceptions

ArgumentOutOfRangeException

The given length is negative.

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadByte()

Reads a single byte from the current stream position.

public byte ReadByte()

Returns

byte

The byte from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadChar()

Reads a 16-bit charater from the current stream position.

public char ReadChar()

Returns

char

The 16-bit character from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadDouble()

Returns a 64-bit floating point from the current stream position.

public double ReadDouble()

Returns

double

The 64-bit floating point from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadHalf()

Returns a 16-bit floating point from the current stream position.

public float ReadHalf()

Returns

float

The 16-bit floating point from the current stream position.

Remarks

Since there is no 16-bit floating point value type the result will be returned as a 32-bit floating point.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadInt16()

Reads a 16-bit signed integer from the current stream position.

public short ReadInt16()

Returns

short

The 16-bit signed integer from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadInt32()

Reads a 32-bit signed integer from the current stream position.

public int ReadInt32()

Returns

int

The 32-bit signed integer from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadInt64()

Reads a 64-bit signed integer from the current stream position.

public long ReadInt64()

Returns

long

The 64-bit signed integer from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadSByte()

Reads a signed byte from the current stream position.

public sbyte ReadSByte()

Returns

sbyte

The signed byte from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadSingle()

Returns a 32-bit floating point from the current stream position.

public float ReadSingle()

Returns

float

The 32-bit floating point from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadUInt16()

Reads a 16-bit unsigned integer from the current stream position.

public ushort ReadUInt16()

Returns

ushort

The 16-bit unsigned integer from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadUInt32()

Reads a 32-bit unsigned integer from the current stream position.

public uint ReadUInt32()

Returns

uint

The 32-bit unsigned integer from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.

ReadUInt64()

Reads a 64-bit unsigned integer from the current stream position.

public ulong ReadUInt64()

Returns

ulong

The 64-bit unsigned integer from the current stream position.

Exceptions

EndOfStreamException

The stream has reached the end before finishing the operation.