Skip to content

Latest commit

 

History

History
954 lines (952 loc) · 30.5 KB

File metadata and controls

954 lines (952 loc) · 30.5 KB
title BitReader
name BitReader
permalink /api/bit-reader/

BitReader ``class``

Namespace: MLAPI.Serialization

Assembly: MLAPI.dll

A BinaryReader that can do bit wise manipulation when backed by a BitStream

Public Constructors

public [``BitReader``](/MLAPI/api/bit-reader/)(``Stream`` stream);

Creates a new BitReader backed by a given stream

Parameters

``Stream`` stream

The stream to read from


Public Methods

public ``void`` SetStream(``Stream`` stream);

Changes the underlying stream the reader is reading from

Parameters

``Stream`` stream

The stream to read from


public ``int`` ReadByte();

Reads a single byte

Returns ``int``

The byte read as an integer


public ``byte`` ReadByteDirect();

Reads a byte

Returns ``byte``

The byte read


public ``bool`` ReadBit();

Reads a single bit

Returns ``bool``

The bit read


public ``bool`` ReadBool();

Reads a single bit

Returns ``bool``

The bit read


public ``void`` SkipPadBits();

Skips pad bits and aligns the position to the next byte


public ``object`` ReadObjectPacked(``Type`` type);

Reads a single boxed object of a given type in a packed format

Parameters

``Type`` type

The type to read

Returns ``object``

Returns the boxed read object


public ``float`` ReadSingle();

Read a single-precision floating point value from the stream.

Returns ``float``

The read value


public ``double`` ReadDouble();

Read a double-precision floating point value from the stream.

Returns ``double``

The read value


public ``float`` ReadSinglePacked();

Read a single-precision floating point value from the stream from a varint

Returns ``float``

The read value


public ``double`` ReadDoublePacked();

Read a double-precision floating point value from the stream as a varint

Returns ``double``

The read value


public ``Vector2`` ReadVector2();

Read a Vector2 from the stream.

Returns ``Vector2``

The Vector2 read from the stream.


public ``Vector2`` ReadVector2Packed();

Read a Vector2 from the stream.

Returns ``Vector2``

The Vector2 read from the stream.


public ``Vector3`` ReadVector3();

Read a Vector3 from the stream.

Returns ``Vector3``

The Vector3 read from the stream.


public ``Vector3`` ReadVector3Packed();

Read a Vector3 from the stream.

Returns ``Vector3``

The Vector3 read from the stream.


public ``Vector4`` ReadVector4();

Read a Vector4 from the stream.

Returns ``Vector4``

The Vector4 read from the stream.


public ``Vector4`` ReadVector4Packed();

Read a Vector4 from the stream.

Returns ``Vector4``

The Vector4 read from the stream.


public ``Color`` ReadColor();

Read a Color from the stream.

Returns ``Color``

The Color read from the stream.


public ``Color`` ReadColorPacked();

Read a Color from the stream.

Returns ``Color``

The Color read from the stream.


public ``Color32`` ReadColor32();

Read a Color32 from the stream.

Returns ``Color32``

The Color32 read from the stream.


public ``Ray`` ReadRay();

Read a Ray from the stream.

Returns ``Ray``

The Ray read from the stream.


public ``Ray`` ReadRayPacked();

Read a Ray from the stream.

Returns ``Ray``

The Ray read from the stream.


public ``float`` ReadRangedSingle(``float`` minValue, ``float`` maxValue, ``int`` bytes);

Read a single-precision floating point value from the stream. The value is between (inclusive) the minValue and maxValue.

Parameters

``float`` minValue

Minimum value that this value could be

``float`` maxValue

Maximum possible value that this could be

``int`` bytes

How many bytes the compressed value occupies. Must be between 1 and 4 (inclusive)

Returns ``float``

The read value


public ``double`` ReadRangedDouble(``double`` minValue, ``double`` maxValue, ``int`` bytes);

read a double-precision floating point value from the stream. The value is between (inclusive) the minValue and maxValue.

Parameters

``double`` minValue

Minimum value that this value could be

``double`` maxValue

Maximum possible value that this could be

``int`` bytes

How many bytes the compressed value occupies. Must be between 1 and 8 (inclusive)

Returns ``double``

The read value


public ``Quaternion`` ReadRotation(``int`` bytesPerAngle);

Read a rotation from the stream.

Parameters

``int`` bytesPerAngle

How many bytes each angle occupies. Must be between 1 and 4 (inclusive)

Returns ``Quaternion``

The rotation read from the stream


public ``ulong`` ReadBits(``int`` bitCount);

Read a certain amount of bits from the stream.

Parameters

``int`` bitCount

How many bits to read. Minimum 0, maximum 8.

Returns ``ulong``

The bits that were read


public ``byte`` ReadByteBits(``int`` bitCount);

Read a certain amount of bits from the stream.

Parameters

``int`` bitCount

How many bits to read. Minimum 0, maximum 64.

Returns ``byte``

The bits that were read


public ``byte`` ReadNibble(``bool`` asUpper);

Read a nibble (4 bits) from the stream.

Parameters

``bool`` asUpper

Whether or not the nibble should be left-shifted by 4 bits

Returns ``byte``

The nibble that was read


public ``byte`` ReadNibble();

Read a nibble (4 bits) from the stream.

Returns ``byte``

The nibble that was read


public ``sbyte`` ReadSByte();

Reads a signed byte

Returns ``sbyte``

Value read from stream.


public ``ushort`` ReadUInt16();

Read an unsigned short (UInt16) from the stream.

Returns ``ushort``

Value read from stream.


public ``short`` ReadInt16();

Read a signed short (Int16) from the stream.

Returns ``short``

Value read from stream.


public ``Char`` ReadChar();

Read a single character from the stream

Returns ``Char``

Value read from stream.


public ``uint`` ReadUInt32();

Read an unsigned int (UInt32) from the stream.

Returns ``uint``

Value read from stream.


public ``int`` ReadInt32();

Read a signed int (Int32) from the stream.

Returns ``int``

Value read from stream.


public ``ulong`` ReadUInt64();

Read an unsigned long (UInt64) from the stream.

Returns ``ulong``

Value read from stream.


public ``long`` ReadInt64();

Read a signed long (Int64) from the stream.

Returns ``long``

Value read from stream.


public ``short`` ReadInt16Packed();

Read a ZigZag encoded varint signed short (Int16) from the stream.

Returns ``short``

Decoded un-varinted value.


public ``ushort`` ReadUInt16Packed();

Read a varint unsigned short (UInt16) from the stream.

Returns ``ushort``

Un-varinted value.


public ``Char`` ReadCharPacked();

Read a varint two-byte character from the stream.

Returns ``Char``

Un-varinted value.


public ``int`` ReadInt32Packed();

Read a ZigZag encoded varint signed int (Int32) from the stream.

Returns ``int``

Decoded un-varinted value.


public ``uint`` ReadUInt32Packed();

Read a varint unsigned int (UInt32) from the stream.

Returns ``uint``

Un-varinted value.


public ``long`` ReadInt64Packed();

Read a ZigZag encoded varint signed long(Int64) from the stream.

Returns ``long``

Decoded un-varinted value.


public ``ulong`` ReadUInt64Packed();

Read a varint unsigned long (UInt64) from the stream.

Returns ``ulong``

Un-varinted value.


public ``StringBuilder`` ReadString(``bool`` oneByteChars);

Parameters

``bool`` oneByteChars


public ``StringBuilder`` ReadString(``StringBuilder`` builder, ``bool`` oneByteChars);

Parameters

``StringBuilder`` builder

``bool`` oneByteChars


public ``StringBuilder`` ReadStringPacked(``StringBuilder`` builder);

Parameters

``StringBuilder`` builder


public ``StringBuilder`` ReadStringDiff(``string`` compare, ``bool`` oneByteChars);

Parameters

``string`` compare

``bool`` oneByteChars


public ``StringBuilder`` ReadStringDiff(``StringBuilder`` builder, ``string`` compare, ``bool`` oneByteChars);

Parameters

``StringBuilder`` builder

``string`` compare

``bool`` oneByteChars


public ``StringBuilder`` ReadStringDiff(``StringBuilder`` compareAndBuffer, ``bool`` oneByteChars);

Parameters

``StringBuilder`` compareAndBuffer

``bool`` oneByteChars


public ``StringBuilder`` ReadStringPackedDiff(``string`` compare);

Parameters

``string`` compare


public ``StringBuilder`` ReadStringPackedDiff(``StringBuilder`` builder, ``string`` compare);

Parameters

``StringBuilder`` builder

``string`` compare


public ``StringBuilder`` ReadStringPackedDiff(``StringBuilder`` compareAndBuffer);

Parameters

``StringBuilder`` compareAndBuffer


public ``byte[]`` ReadByteArray(``byte[]`` readTo, ``long`` knownLength);

Parameters

``byte[]`` readTo

``long`` knownLength


public ``byte[]`` ReadByteArrayDiff(``byte[]`` readTo, ``long`` knownLength);

Parameters

``byte[]`` readTo

``long`` knownLength


public ``short[]`` ReadShortArray(``short[]`` readTo, ``long`` knownLength);

Parameters

``short[]`` readTo

``long`` knownLength


public ``short[]`` ReadShortArrayPacked(``short[]`` readTo, ``long`` knownLength);

Parameters

``short[]`` readTo

``long`` knownLength


public ``short[]`` ReadShortArrayDiff(``short[]`` readTo, ``long`` knownLength);

Parameters

``short[]`` readTo

``long`` knownLength


public ``short[]`` ReadShortArrayPackedDiff(``short[]`` readTo, ``long`` knownLength);

Parameters

``short[]`` readTo

``long`` knownLength


public ``ushort[]`` ReadUShortArray(``ushort[]`` readTo, ``long`` knownLength);

Parameters

``ushort[]`` readTo

``long`` knownLength


public ``ushort[]`` ReadUShortArrayPacked(``ushort[]`` readTo, ``long`` knownLength);

Parameters

``ushort[]`` readTo

``long`` knownLength


public ``ushort[]`` ReadUShortArrayDiff(``ushort[]`` readTo, ``long`` knownLength);

Parameters

``ushort[]`` readTo

``long`` knownLength


public ``ushort[]`` ReadUShortArrayPackedDiff(``ushort[]`` readTo, ``long`` knownLength);

Parameters

``ushort[]`` readTo

``long`` knownLength


public ``int[]`` ReadIntArray(``int[]`` readTo, ``long`` knownLength);

Parameters

``int[]`` readTo

``long`` knownLength


public ``int[]`` ReadIntArrayPacked(``int[]`` readTo, ``long`` knownLength);

Parameters

``int[]`` readTo

``long`` knownLength


public ``int[]`` ReadIntArrayDiff(``int[]`` readTo, ``long`` knownLength);

Parameters

``int[]`` readTo

``long`` knownLength


public ``int[]`` ReadIntArrayPackedDiff(``int[]`` readTo, ``long`` knownLength);

Parameters

``int[]`` readTo

``long`` knownLength


public ``uint[]`` ReadUIntArray(``uint[]`` readTo, ``long`` knownLength);

Parameters

``uint[]`` readTo

``long`` knownLength


public ``uint[]`` ReadUIntArrayPacked(``uint[]`` readTo, ``long`` knownLength);

Parameters

``uint[]`` readTo

``long`` knownLength


public ``uint[]`` ReadUIntArrayDiff(``uint[]`` readTo, ``long`` knownLength);

Parameters

``uint[]`` readTo

``long`` knownLength


public ``long[]`` ReadLongArray(``long[]`` readTo, ``long`` knownLength);

Parameters

``long[]`` readTo

``long`` knownLength


public ``long[]`` ReadLongArrayPacked(``long[]`` readTo, ``long`` knownLength);

Parameters

``long[]`` readTo

``long`` knownLength


public ``long[]`` ReadLongArrayDiff(``long[]`` readTo, ``long`` knownLength);

Parameters

``long[]`` readTo

``long`` knownLength


public ``long[]`` ReadLongArrayPackedDiff(``long[]`` readTo, ``long`` knownLength);

Parameters

``long[]`` readTo

``long`` knownLength


public ``ulong[]`` ReadULongArray(``ulong[]`` readTo, ``long`` knownLength);

Parameters

``ulong[]`` readTo

``long`` knownLength


public ``ulong[]`` ReadULongArrayPacked(``ulong[]`` readTo, ``long`` knownLength);

Parameters

``ulong[]`` readTo

``long`` knownLength


public ``ulong[]`` ReadULongArrayDiff(``ulong[]`` readTo, ``long`` knownLength);

Parameters

``ulong[]`` readTo

``long`` knownLength


public ``ulong[]`` ReadULongArrayPackedDiff(``ulong[]`` readTo, ``long`` knownLength);

Parameters

``ulong[]`` readTo

``long`` knownLength


public ``float[]`` ReadFloatArray(``float[]`` readTo, ``long`` knownLength);

Parameters

``float[]`` readTo

``long`` knownLength


public ``float[]`` ReadFloatArrayPacked(``float[]`` readTo, ``long`` knownLength);

Parameters

``float[]`` readTo

``long`` knownLength


public ``float[]`` ReadFloatArrayDiff(``float[]`` readTo, ``long`` knownLength);

Parameters

``float[]`` readTo

``long`` knownLength


public ``float[]`` ReadFloatArrayPackedDiff(``float[]`` readTo, ``long`` knownLength);

Parameters

``float[]`` readTo

``long`` knownLength


public ``double[]`` ReadDoubleArray(``double[]`` readTo, ``long`` knownLength);

Parameters

``double[]`` readTo

``long`` knownLength


public ``double[]`` ReadDoubleArrayPacked(``double[]`` readTo, ``long`` knownLength);

Parameters

``double[]`` readTo

``long`` knownLength


public ``double[]`` ReadDoubleArrayDiff(``double[]`` readTo, ``long`` knownLength);

Parameters

``double[]`` readTo

``long`` knownLength


public ``double[]`` ReadDoubleArrayPackedDiff(``double[]`` readTo, ``long`` knownLength);

Parameters

``double[]`` readTo

``long`` knownLength



Inherited Methods

public ``bool`` Equals(``object`` obj);

Inherited from: ``object``
Parameters

``object`` obj


public ``int`` GetHashCode();

Inherited from: ``object``

public ``Type`` GetType();

Inherited from: ``object``

public ``string`` ToString();

Inherited from: ``object``