Diffusion .NET Client Library  6.1.5
 All Classes Namespaces Functions Variables Enumerations Enumerator Properties Events Pages
PushTechnology.ClientInterface.IO.FlexibleBinaryReader Class Reference

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

Public Member Functions

 FlexibleBinaryReader (Stream inputStream, ByteOrder valueByteOrder)
 Creates a new FlexibleBinaryReader that will be able to read basic data types from the given byte stream. More...
 
void Read (byte[] outputBuffer, int offset, int length)
 Reads the specified number of bytes from the current byte stream position. More...
 
byte[] Read (int length)
 Reads the specified number of bytes from the current byte stream position. More...
 
byte ReadByte ()
 Reads a single byte from the current stream position. More...
 
sbyte ReadSByte ()
 Reads a signed byte from the current stream position. More...
 
char ReadChar ()
 Reads a 16-bit charater from the current stream position. More...
 
short ReadInt16 ()
 Reads a 16-bit signed integer from the current stream position. More...
 
ushort ReadUInt16 ()
 Reads a 16-bit unsigned integer from the current stream position. More...
 
int ReadInt32 ()
 Reads a 32-bit signed integer from the current stream position. More...
 
uint ReadUInt32 ()
 Reads a 32-bit unsigned integer from the current stream position. More...
 
long ReadInt64 ()
 Reads a 64-bit signed integer from the current stream position. More...
 
ulong ReadUInt64 ()
 Reads a 64-bit unsigned integer from the current stream position. More...
 
float ReadHalf ()
 Returns a 16-bit floating point from the current stream position. More...
 
float ReadSingle ()
 Returns a 32-bit floating point from the current stream position. More...
 
double ReadDouble ()
 Returns a 64-bit floating point from the current stream position. More...
 

Public Attributes

ByteOrder ByteOrder => byteOrder
 Returns the byte order the reader operates in. More...
 
bool IsEndOfStream => inputStream.Position >= inputStream.Length
 Returns true if the reader reached the end of the stream. More...
 
Stream BaseStream => inputStream
 Returns the underlying stream. More...
 

Detailed Description

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

Constructor & Destructor Documentation

PushTechnology.ClientInterface.IO.FlexibleBinaryReader.FlexibleBinaryReader ( Stream  inputStream,
ByteOrder  valueByteOrder 
)

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

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

Parameters
inputStreamThe byte stream to read from.
valueByteOrderThe byte order to use for all reading operations.
Exceptions
ArgumentNullExceptionThe given stream is null.
ArgumentExceptionThe given stream does not support reading.

Member Function Documentation

void PushTechnology.ClientInterface.IO.FlexibleBinaryReader.Read ( byte[]  outputBuffer,
int  offset,
int  length 
)

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

Parameters
outputBufferThe buffer to read data into.
offsetThe starting index of the output buffer.
lengthThe number of bytes to read.
Exceptions
ArgumentNullExceptionThe given buffer is null.
ArgumentOutOfRangeExceptionThe given offset or length are negative or bigger than the given buffer.
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
byte [] PushTechnology.ClientInterface.IO.FlexibleBinaryReader.Read ( int  length)

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

Parameters
lengthThe number of bytes to read.
Returns
The byte array containing the data that has been read from the input stream.
Exceptions
ArgumentOutOfRangeExceptionThe given length is negative.
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
byte PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadByte ( )

Reads a single byte from the current stream position.

Returns
The byte from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
char PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadChar ( )

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

Returns
The 16-bit character form the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
double PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadDouble ( )

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

Returns
The 64-bit floating point from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
float PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadHalf ( )

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

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

Returns
The 16-bit floating point from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
short PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadInt16 ( )

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

Returns
The 16-bit signed integer from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
int PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadInt32 ( )

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

Returns
The 32-bit signed integer from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
long PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadInt64 ( )

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

Returns
The 64-bit signed integer from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
sbyte PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadSByte ( )

Reads a signed byte from the current stream position.

Returns
The signed byte from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
float PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadSingle ( )

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

Returns
The 32-bit floating point from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
ushort PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadUInt16 ( )

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

Returns
The 16-bit unsigned integer from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
uint PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadUInt32 ( )

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

Returns
The 32-bit unsigned integer from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.
ulong PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ReadUInt64 ( )

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

Returns
The 64-bit unsigned integer from the current stream position.
Exceptions
EndOfStreamExceptionThe stream has reached the end before finishing the operation.

Member Data Documentation

Stream PushTechnology.ClientInterface.IO.FlexibleBinaryReader.BaseStream => inputStream

Returns the underlying stream.

ByteOrder PushTechnology.ClientInterface.IO.FlexibleBinaryReader.ByteOrder => byteOrder

Returns the byte order the reader operates in.

bool PushTechnology.ClientInterface.IO.FlexibleBinaryReader.IsEndOfStream => inputStream.Position >= inputStream.Length

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


The documentation for this class was generated from the following file: