Photon Quantum 3.0.0

Public Member Functions | Static Public Member Functions | Properties | List of all members
Photon.Deterministic.BitStream Class Reference

Writes information at the bit level to a byte array. More...

Public Member Functions

 BitStream ()
 Constructs a new instance of the BitStream class with a default buffer size of 0. More...
 
 BitStream (byte[] arr)
 Constructs a new instance of the BitStream class with the specified buffer. More...
 
 BitStream (byte[] arr, int size)
 Constructs a new instance of the BitStream class with the specified buffer and size. More...
 
 BitStream (byte[] arr, int size, int offset)
 Constructs a new instance of the BitStream class with the specified buffer, size, and offset. More...
 
 BitStream (Int32 size)
 Constructs a new instance of the BitStream class with the specified buffer size. More...
 
delegate void ArrayElementSerializer< T > (ref T element)
 Represents a delegate for serializing an array element. More...
 
void BlockCopyToArray (Array dst, int dstOffset)
 Block copy the bitstream buffer into an array. More...
 
bool CanRead ()
 Determines if there is at least one bit available to read. More...
 
bool CanRead (int bits)
 Determines whether the BitStream can read the specified number of bits. More...
 
bool CanWrite ()
 Determines whether the BitStream can write one bit. More...
 
bool CanWrite (int bits)
 Determines if the given number of bits can be written to the BitStream without exceeding the buffer size. More...
 
bool Condition (bool condition)
 Serializes or deserializes a condition value. More...
 
void CopyFromArray (Byte[] array)
 Copies data from the input array to the internal buffer. More...
 
unsafe void CopyFromBuffer (byte *buffer, int length)
 Copies a specified number of bytes from a buffer into the internal buffer of the BitStream. More...
 
bool ReadBool ()
 Reads a boolean value from the current position in the BitStream. More...
 
bool ReadBoolean ()
 Reads a boolean value from the BitStream. More...
 
byte ReadByte ()
 Reads a byte from the bit stream using the default number of bits (8 bits). More...
 
byte ReadByte (int bits)
 Reads a byte from the BitStream with the specified number of bits. More...
 
void ReadByteArray (byte[] to)
 Reads a byte array from the BitStream object. More...
 
void ReadByteArray (byte[] to, int count)
 Reads a byte array from the BitStream, starting from the current position. More...
 
void ReadByteArray (byte[] to, int offset, int count)
 
byte[] ReadByteArray (int size)
 Reads a byte array from the BitStream with the specified size. More...
 
byte[] ReadByteArrayLengthPrefixed ()
 Reads a byte array from the bit stream that is length prefixed. More...
 
Char ReadChar ()
 Reads a character from the BitStream. More...
 
double ReadDouble ()
 Reads a double value from the bit stream. More...
 
float ReadFloat ()
 Reads a single-precision floating-point number from the BitStream. More...
 
FP ReadFP ()
 The BitStream class is used for reading and writing data in a binary format. More...
 
FPBounds2 ReadFPBounds2 ()
 Reads an instance of FPBounds2 from the BitStream. More...
 
FPBounds3 ReadFPBounds3 ()
 Reads a FPBounds3 structure from the BitStream. More...
 
FPMatrix2x2 ReadFPMatrix2x2 ()
 Reads a 2x2 matrix of fixed-point numbers from the BitStream. More...
 
FPMatrix3x3 ReadFPMatrix3x3 ()
 
FPMatrix4x4 ReadFPMatrix4x4 ()
 Reads a 4x4 matrix of Fixed Point numbers from the BitStream. More...
 
FPQuaternion ReadFPQuaternion ()
 Reads and returns an instance of FPQuaternion from the current BitStream. More...
 
FPVector2 ReadFPVector2 ()
 Reads an FPVector2 from the current BitStream. More...
 
FPVector3 ReadFPVector3 ()
 Reads a FPVector3 from the BitStream. More...
 
Guid ReadGuid ()
 Reads a Guid from the BitStream by reading 16 bytes and constructing a Guid object. More...
 
int ReadInt ()
 Reads an integer value from the bit stream. More...
 
int ReadInt (int bits)
 Reads an integer value from the bit stream. More...
 
int ReadInt32VarLength (int blockSize)
 Reads a variable-length 32-bit integer from the buffer. More...
 
long ReadInt64VarLength (int blockSize)
 Reads a variable-length 64-bit signed integer from the BitStream with the specified block size. More...
 
int ReadInt_Shifted (int bits, int shift)
 Reads an integer value shifted by the specified amount of bits from the BitStream. More...
 
long ReadLong ()
 Reads a long integer from the BitStream. More...
 
long ReadLong (int bits)
 Reads a long value from the BitStream with the specified number of bits. More...
 
sbyte ReadSByte ()
 Reads a signed byte value from the bit stream. More...
 
short ReadShort ()
 Reads a 16-bit integer from the bit stream. More...
 
short ReadShort (int bits)
 Reads a short value from the BitStream. More...
 
string ReadString ()
 Reads a string from the BitStream using the specified encoding. More...
 
string ReadString (Encoding encoding)
 Reads a string from the bit stream using the specified encoding. More...
 
String ReadStringGZip (Encoding encoding)
 Reads a compressed string from the BitStream using GZip decompression. More...
 
uint ReadUInt ()
 Reads an unsigned 32-bit integer from the BitStream. More...
 
uint ReadUInt (int bits)
 Reads an unsigned integer from the BitStream with the specified number of bits. More...
 
uint ReadUInt32VarLength (int blockSize)
 Reads a variable length unsigned 32-bit integer from the BitStream. More...
 
ulong ReadUInt64VarLength (int blockSize)
 Reads an unsigned 64-bit integer with variable length from the BitStream. More...
 
ulong ReadULong ()
 Reads an unsigned 64-bit integer from the BitStream. More...
 
ulong ReadULong (int bits)
 Reads an unsigned 64-bit integer (ulong) from the BitStream with the specified number of bits. If the specified number of bits is less than or equal to 32, it reads an unsigned 32-bit integer (uint) instead. More...
 
ushort ReadUShort ()
 Reads an unsigned short (16 bits) from the BitStream. More...
 
ushort ReadUShort (int bits)
 Reads an unsigned short value from the BitStream. More...
 
void Reset ()
 Resets the BitStream to its initial state. More...
 
void Reset (Int32 byteSize)
 Resets the BitStream to its initial state, clearing the data and setting the pointer and maximum pointer values. More...
 
void ResetFast (Int32 byteSize)
 Resets the BitStream to a specified byte size. More...
 
void RoundTo4Bytes ()
 Pads the stream with 0s to make it 4-byte exact. More...
 
int RoundToByte ()
 Rounds the current position in the stream to the nearest byte boundary and returns the number of bytes written up to that point. More...
 
unsafe void Serialize (byte *v)
 Serializes or deserializes a byte value. More...
 
unsafe void Serialize (int *v)
 Serializes or deserializes a value of type int*. More...
 
unsafe void Serialize (int *v, int bits)
 Serializes or deserializes a value. More...
 
unsafe void Serialize (long *v)
 Serializes or deserializes a long value. More...
 
void Serialize (ref bool value)
 Serializes or deserializes a boolean value. More...
 
void Serialize (ref Byte value)
 Serializes or deserializes a Byte value. More...
 
void Serialize (ref Byte[] array, ref Int32 length)
 Serializes or deserializes an array of bytes with a variable length. More...
 
void Serialize (ref Byte[] array, ref Int32 length, Int32 fixedSize)
 Serializes or deserializes a byte array with a fixed size. More...
 
void Serialize (ref Byte[] value)
 Serializes or deserializes a byte array. More...
 
void Serialize (ref Byte[] value, Int32 fixedSize)
 Serializes or deserializes a fixed-sized byte array. More...
 
void Serialize (ref Double value)
 Serializes or deserializes a Double value. More...
 
void Serialize (ref float value)
 Serializes or deserializes a string value. More...
 
void Serialize (ref FP value)
 Serializes or deserializes an FP value. More...
 
void Serialize (ref FPQuaternion value)
 Serializes or deserializes an FPQuaternion value. More...
 
void Serialize (ref FPVector2 value)
 Serializes or deserializes a FPVector2 value. More...
 
void Serialize (ref FPVector3 value)
 Serializes or deserializes a FPVector3 value. More...
 
void Serialize (ref int value)
 Serializes or deserializes a value of type int. More...
 
void Serialize (ref int value, int bits)
 Serializes or deserializes a value of type int with the specified number of bits. More...
 
void Serialize (ref Int32[] value)
 Serializes or deserializes an array of Int32 values. More...
 
void Serialize (ref Int64 value)
 Serializes or deserializes a 64-bit signed integer value. More...
 
void Serialize (ref String value)
 Serializes or deserializes a string value. More...
 
void Serialize (ref uint value)
 Serializes or deserializes a string value. More...
 
void Serialize (ref uint value, int bits)
 Serializes or deserializes a given uint value. More...
 
void Serialize (ref UInt64 value)
 Serializes or deserializes a UInt64 value. More...
 
void Serialize (ref ulong value, int bits)
 Serializes or deserializes a ulong value with a specified number of bits. More...
 
void Serialize (ref ushort value)
 Serializes or deserializes a ushort (UInt16) value. More...
 
unsafe void Serialize (sbyte *v)
 Serializes or deserializes a value. More...
 
unsafe void Serialize (short *v)
 Serializes or deserializes a short value. More...
 
unsafe void Serialize (uint *v)
 Serializes or deserializes a pointer to an unsigned integer. More...
 
unsafe void Serialize (uint *v, int bits)
 Serializes or deserializes a string value. More...
 
unsafe void Serialize (ulong *v)
 Serializes or deserializes the value pointed to by a ulong pointer. More...
 
unsafe void Serialize (ushort *v)
 Serializes or deserializes a ushort value. More...
 
void SerializeArray< T > (ref T[] array, ArrayElementSerializer< T > serializer)
 Serializes or deserializes an array using a custom serializer. More...
 
void SerializeArrayLength< T > (ref T[] array)
 Serializes or deserializes the length of a generic array. More...
 
void SerializeAsByteArray (BitStream otherStream)
 Serializes the given BitStream as a byte array. More...
 
unsafe void SerializeBuffer (byte *buffer, int length)
 Serializes or deserializes a buffer of bytes. More...
 
unsafe void SerializeBuffer (int *buffer, int length)
 Serializes or deserializes a buffer of integers. More...
 
unsafe void SerializeBuffer (long *buffer, int length)
 Serializes or deserializes a buffer of long values. More...
 
unsafe void SerializeBuffer (sbyte *buffer, int length)
 Serializes or deserializes a buffer of signed bytes. More...
 
unsafe void SerializeBuffer (short *buffer, int length)
 Serializes or deserializes a buffer of type short. More...
 
unsafe void SerializeBuffer (uint *buffer, int length)
 
unsafe void SerializeBuffer (ulong *buffer, int length)
 Serializes or deserializes a buffer of ulong values. More...
 
unsafe void SerializeBuffer (ushort *buffer, int length)
 Serializes or deserializes a buffer of unsigned shorts. More...
 
void SetBuffer (byte[] arr)
 Sets the buffer of the BitStream with the specified byte array. More...
 
void SetBuffer (byte[] arr, int size)
 Sets the buffer and size of the BitStream instance. More...
 
void SetBuffer (byte[] arr, int size, int offset)
 Sets the buffer of the BitStream instance. More...
 
byte[] ToArray ()
 Copies the data from the BitStream into a new byte array. More...
 
bool WriteBool (bool value)
 Writes a boolean value to the bit stream. More...
 
bool WriteBoolean (bool value)
 Writes a boolean value to the BitStream. More...
 
void WriteByte (byte value)
 Writes a byte value to the BitStream using 8 bits. More...
 
void WriteByte (byte value, int bits)
 Writes a byte value to the BitStream with a specified number of bits. More...
 
void WriteByteArray (byte[] from)
 Writes a byte array to the BitStream. More...
 
void WriteByteArray (byte[] from, int count)
 Writes a byte array to the BitStream starting from a specified offset and writing a specified number of bytes. More...
 
void WriteByteArray (byte[] from, int offset, int count)
 Writes a byte array to the BitStream. More...
 
void WriteByteArrayLengthPrefixed (byte[] array)
 Writes a byte array to the BitStream with a length prefix. More...
 
void WriteByteArrayLengthPrefixed (byte[] array, int maxLength)
 Writes a byte array to the bit stream in a length-prefixed format. More...
 
void WriteChar (Char value)
 Writes a character to the BitStream by converting it to a 16-bit unsigned integer. More...
 
void WriteDouble (double value)
 Writes a double value to the bit stream. More...
 
void WriteFloat (float value)
 Writes a single-precision floating-point value to the BitStream. More...
 
void WriteFP (FP fp)
 Writes the given fixed-point value to the bit stream. More...
 
void WriteFPBounds2 (FPBounds2 v)
 Writes an instance of FPBounds2 to the current BitStream object. More...
 
void WriteFPBounds3 (FPBounds3 v)
 Writes the FPBounds3 structure to the BitStream. More...
 
void WriteFPMatrix2x2 (FPMatrix2x2 v)
 Writes a FPMatrix2x2 to the BitStream. More...
 
void WriteFPMatrix3x3 (FPMatrix3x3 v)
 Writes a 3x3 matrix of fixed-point numbers to the current instance of the BitStream. More...
 
void WriteFPMatrix4x4 (FPMatrix4x4 v)
 Writes a 4x4 matrix of Fixed Point (FP) values to the bit stream. More...
 
void WriteFPQuaternion (FPQuaternion v)
 Writes a FPQuaternion value to the BitStream. More...
 
void WriteFPVector2 (FPVector2 v)
 Writes an instance of FPVector2 to the BitStream. More...
 
void WriteFPVector3 (FPVector3 v)
 Writes an FPVector3 to the BitStream. More...
 
void WriteGuid (Guid guid)
 Writes a Guid to the BitStream. More...
 
void WriteInt (int value)
 Writes an integer value to the BitStream using a specified number of bits. More...
 
void WriteInt (int value, int bits)
 Writes an integer value to the bitstream using the specified number of bits. More...
 
void WriteInt32VarLength (int value, int blockSize)
 Writes a variable length int32 value to the BitStream. More...
 
void WriteInt64VarLength (long value, int blockSize)
 Writes a signed 64-bit integer using variable-length encoding to the bit stream. More...
 
void WriteInt_Shifted (int value, int bits, int shift)
 Writes an integer value to the BitStream with specified number of bits and a shift value. More...
 
void WriteLong (long value)
 Writes a long value to the BitStream. More...
 
void WriteLong (long value, int bits)
 Writes a long value to the BitStream with the specified number of bits. More...
 
void WriteNullableFP (FP fp)
 Writes a nullable fixed-point value to the BitStream. More...
 
void WriteSByte (sbyte value)
 Writes a signed byte value to the bit stream. More...
 
void WriteShort (short value)
 Writes a short value to the BitStream using the specified number of bits. More...
 
void WriteShort (short value, int bits)
 Writes a signed 16-bit integer value to the BitStream with specified number of bits. More...
 
void WriteString (string value)
 Writes a string to the BitStream using the specified encoding. More...
 
void WriteString (string value, Encoding encoding)
 Writes a string value to the BitStream using the specified encoding. More...
 
void WriteStringGZip (String value, Encoding encoding)
 Writes a string to the BitStream using GZip compression. More...
 
void WriteUInt (uint value)
 Writes an unsigned integer value of 32 bits to the bit stream. More...
 
void WriteUInt (uint value, int bits)
 Writes an unsigned integer value to the BitStream with the specified number of bits. More...
 
void WriteUInt32VarLength (uint value, int blockSize)
 Writes a variable-length unsigned 32-bit integer to the BitStream. More...
 
void WriteUInt64VarLength (ulong value, int blockSize)
 Writes a UInt64 variable-length value to the BitStream using the specified blockSize. More...
 
void WriteULong (ulong value)
 Writes an unsigned long value to the bit stream using a specified number of bits. More...
 
void WriteULong (ulong value, int bits)
 Writes an unsigned long value to the bit stream. If the number of bits is less than or equal to 32, it writes the lower 32 bits of the value. Otherwise, it writes the lower 32 bits first, followed by the remaining bits. More...
 
void WriteUShort (ushort value)
 Writes a ushort value to the BitStream. More...
 
void WriteUShort (ushort value, int bits)
 Writes an unsigned short value to the BitStream. More...
 

Static Public Member Functions

static void WriteByteAt (byte[] data, int ptr, int bits, byte value)
 Writes a byte value at the specified position in a byte array, considering the number of bits to be written for the value. More...
 

Properties

int BytesRequired [get]
 Gets the number of bytes required to represent the current position of the stream pointer in the BitStream. More...
 
int Capacity [get]
 Gets the capacity of the BitStream, in bytes. More...
 
Byte[] Data [get]
 Represents the data buffer used by the BitStream. More...
 
bool Done [get]
 Gets a value indicating whether the stream pointer of the BitStream has reached the maximum pointer position. More...
 
bool DoneOrOverflow [get]
 Indicates whether a bit stream is done (reached the end) or overflowing. More...
 
bool IsEvenBytes [get]
 Gets a value indicating whether the position of the stream pointer in the BitStream is aligned on even bytes. More...
 
int Offset [get]
 Represents the offset in bytes from the beginning of the byte array in the BitStream. More...
 
int OffsetBits [get]
 Represents the offset in bits from the start of the BitStream. More...
 
bool Overflowing [get]
 Gets a value indicating whether the stream pointer of the BitStream has exceeded the maximum pointer position. More...
 
int Position [get, set]
 Represents the position of the stream pointer in the BitStream. More...
 
bool Reading [get, set]
 Gets or sets a value indicating whether the stream is in reading mode. More...
 
bool Writing [get, set]
 Represents the property indicating whether writing is enabled in the BitStream. More...
 

Detailed Description

Writes information at the bit level to a byte array.

Constructor & Destructor Documentation

◆ BitStream() [1/5]

Photon.Deterministic.BitStream.BitStream ( )
inline

Constructs a new instance of the BitStream class with a default buffer size of 0.

◆ BitStream() [2/5]

Photon.Deterministic.BitStream.BitStream ( Int32  size)
inline

Constructs a new instance of the BitStream class with the specified buffer size.

Parameters
sizeThe size of the internal buffer.

◆ BitStream() [3/5]

Photon.Deterministic.BitStream.BitStream ( byte[]  arr)
inline

Constructs a new instance of the BitStream class with the specified buffer.

Parameters
arrThe source data buffer.

◆ BitStream() [4/5]

Photon.Deterministic.BitStream.BitStream ( byte[]  arr,
int  size 
)
inline

Constructs a new instance of the BitStream class with the specified buffer and size.

Parameters
arrThe source data buffer.
sizeThe size to use.

◆ BitStream() [5/5]

Photon.Deterministic.BitStream.BitStream ( byte[]  arr,
int  size,
int  offset 
)
inline

Constructs a new instance of the BitStream class with the specified buffer, size, and offset.

Parameters
arrThe source data buffer.
sizeThe size to use.
offsetThe offset to use.

Member Function Documentation

◆ SetBuffer() [1/3]

void Photon.Deterministic.BitStream.SetBuffer ( byte[]  arr)
inline

Sets the buffer of the BitStream with the specified byte array.

Parameters
arrThe byte array to set as the buffer.

◆ SetBuffer() [2/3]

void Photon.Deterministic.BitStream.SetBuffer ( byte[]  arr,
int  size 
)
inline

Sets the buffer and size of the BitStream instance.

Parameters
arrThe byte array buffer.
sizeThe size of the buffer.

◆ SetBuffer() [3/3]

void Photon.Deterministic.BitStream.SetBuffer ( byte[]  arr,
int  size,
int  offset 
)
inline

Sets the buffer of the BitStream instance.

Parameters
arrThe byte array to set as the buffer for the BitStream.
sizeThe size of the buffer in bytes.
offsetThe offset in bytes from the start of the buffer.

◆ RoundToByte()

int Photon.Deterministic.BitStream.RoundToByte ( )
inline

Rounds the current position in the stream to the nearest byte boundary and returns the number of bytes written up to that point.

Returns
The number of bytes written up to the current position in the stream.

◆ RoundTo4Bytes()

void Photon.Deterministic.BitStream.RoundTo4Bytes ( )
inline

Pads the stream with 0s to make it 4-byte exact.

◆ CanWrite() [1/2]

bool Photon.Deterministic.BitStream.CanWrite ( )
inline

Determines whether the BitStream can write one bit.

Returns
true if the BitStream can write a bit, otherwise false.

◆ CanRead() [1/2]

bool Photon.Deterministic.BitStream.CanRead ( )
inline

Determines if there is at least one bit available to read.

Returns
true if there is one bit available to read; otherwise, false.

◆ CanWrite() [2/2]

bool Photon.Deterministic.BitStream.CanWrite ( int  bits)
inline

Determines if the given number of bits can be written to the BitStream without exceeding the buffer size.

Parameters
bitsThe number of bits to be written.
Returns
true if the given number of bits can be written to the BitStream without exceeding the buffer size; otherwise, false.

◆ CanRead() [2/2]

bool Photon.Deterministic.BitStream.CanRead ( int  bits)
inline

Determines whether the BitStream can read the specified number of bits.

Parameters
bitsThe number of bits to check if can be read.
Returns
true if the BitStream can read the specified number of bits, false otherwise.

◆ CopyFromArray()

void Photon.Deterministic.BitStream.CopyFromArray ( Byte[]  array)
inline

Copies data from the input array to the internal buffer.

Parameters
arrayThe input array to copy data from.

◆ CopyFromBuffer()

unsafe void Photon.Deterministic.BitStream.CopyFromBuffer ( byte *  buffer,
int  length 
)
inline

Copies a specified number of bytes from a buffer into the internal buffer of the BitStream.

Parameters
bufferA pointer to the buffer containing the bytes to be copied.
lengthThe number of bytes to copy.

◆ BlockCopyToArray()

void Photon.Deterministic.BitStream.BlockCopyToArray ( Array  dst,
int  dstOffset 
)
inline

Block copy the bitstream buffer into an array.

◆ Reset() [1/2]

void Photon.Deterministic.BitStream.Reset ( )
inline

Resets the BitStream to its initial state.

◆ Reset() [2/2]

void Photon.Deterministic.BitStream.Reset ( Int32  byteSize)
inline

Resets the BitStream to its initial state, clearing the data and setting the pointer and maximum pointer values.

◆ ResetFast()

void Photon.Deterministic.BitStream.ResetFast ( Int32  byteSize)
inline

Resets the BitStream to a specified byte size.

Parameters
byteSizeThe size, in bytes, to reset the BitStream to.

◆ ToArray()

byte [] Photon.Deterministic.BitStream.ToArray ( )
inline

Copies the data from the BitStream into a new byte array.

Returns
A new byte array containing the copied data.

◆ WriteBool()

bool Photon.Deterministic.BitStream.WriteBool ( bool  value)
inline

Writes a boolean value to the bit stream.

Parameters
valueThe boolean value to write.
Returns
The boolean value that was written to the bit stream.

◆ WriteBoolean()

bool Photon.Deterministic.BitStream.WriteBoolean ( bool  value)
inline

Writes a boolean value to the BitStream.

Parameters
valueThe boolean value to write.
Returns
true if the value was written successfully; otherwise, false.

◆ ReadBool()

bool Photon.Deterministic.BitStream.ReadBool ( )
inline

Reads a boolean value from the current position in the BitStream.

Returns
A boolean value that indicates whether the read value is true (1) or false (0).

◆ ReadBoolean()

bool Photon.Deterministic.BitStream.ReadBoolean ( )
inline

Reads a boolean value from the BitStream.

Returns
Returns the boolean value read from the BitStream.

◆ WriteByte() [1/2]

void Photon.Deterministic.BitStream.WriteByte ( byte  value,
int  bits 
)
inline

Writes a byte value to the BitStream with a specified number of bits.

Parameters
valueThe byte value to write.
bitsThe number of bits to write.

◆ ReadByte() [1/2]

byte Photon.Deterministic.BitStream.ReadByte ( int  bits)
inline

Reads a byte from the BitStream with the specified number of bits.

Parameters
bitsThe number of bits to read the byte.
Returns
The byte read from the BitStream.

◆ WriteByte() [2/2]

void Photon.Deterministic.BitStream.WriteByte ( byte  value)
inline

Writes a byte value to the BitStream using 8 bits.

Parameters
valueThe byte value to be written.

◆ ReadByte() [2/2]

byte Photon.Deterministic.BitStream.ReadByte ( )
inline

Reads a byte from the bit stream using the default number of bits (8 bits).

Returns
The byte read from the bit stream.

◆ ReadSByte()

sbyte Photon.Deterministic.BitStream.ReadSByte ( )
inline

Reads a signed byte value from the bit stream.

Returns
A signed byte value read from the bit stream.

◆ WriteSByte()

void Photon.Deterministic.BitStream.WriteSByte ( sbyte  value)
inline

Writes a signed byte value to the bit stream.

Parameters
valueThe signed byte value to write.

◆ WriteUShort() [1/2]

void Photon.Deterministic.BitStream.WriteUShort ( ushort  value,
int  bits 
)
inline

Writes an unsigned short value to the BitStream.

Parameters
valueThe value to write.
bitsThe number of bits to write.

◆ ReadUShort() [1/2]

ushort Photon.Deterministic.BitStream.ReadUShort ( int  bits)
inline

Reads an unsigned short value from the BitStream.

Parameters
bitsThe number of bits to read, must be less than or equal to 16.
Returns
The unsigned short value read from the BitStream.

◆ WriteUShort() [2/2]

void Photon.Deterministic.BitStream.WriteUShort ( ushort  value)
inline

Writes a ushort value to the BitStream.

Parameters
valueThe ushort value to write.

◆ ReadUShort() [2/2]

ushort Photon.Deterministic.BitStream.ReadUShort ( )
inline

Reads an unsigned short (16 bits) from the BitStream.

Returns
The value read from the BitStream.

◆ WriteShort() [1/2]

void Photon.Deterministic.BitStream.WriteShort ( short  value,
int  bits 
)
inline

Writes a signed 16-bit integer value to the BitStream with specified number of bits.

Parameters
valueThe value to write.
bitsThe number of bits to write. Must be between 1 and 16, inclusive.

◆ ReadShort() [1/2]

short Photon.Deterministic.BitStream.ReadShort ( int  bits)
inline

Reads a short value from the BitStream.

Parameters
bitsThe number of bits to read.
Returns
The short value read from the BitStream.

◆ WriteShort() [2/2]

void Photon.Deterministic.BitStream.WriteShort ( short  value)
inline

Writes a short value to the BitStream using the specified number of bits.

Parameters
valueThe short value to write.

The specified number of bits determines the size of the value that can be written.

◆ ReadShort() [2/2]

short Photon.Deterministic.BitStream.ReadShort ( )
inline

Reads a 16-bit integer from the bit stream.

Returns
The 16-bit integer read from the bit stream.

◆ WriteChar()

void Photon.Deterministic.BitStream.WriteChar ( Char  value)
inline

Writes a character to the BitStream by converting it to a 16-bit unsigned integer.

Parameters
valueThe character to write.

◆ ReadChar()

Char Photon.Deterministic.BitStream.ReadChar ( )
inline

Reads a character from the BitStream.

Returns
The character read from the BitStream.

◆ WriteInt64VarLength()

void Photon.Deterministic.BitStream.WriteInt64VarLength ( long  value,
int  blockSize 
)
inline

Writes a signed 64-bit integer using variable-length encoding to the bit stream.

Parameters
valueThe signed 64-bit integer to write.
blockSizeThe block size for encoding the integer.

◆ WriteInt32VarLength()

void Photon.Deterministic.BitStream.WriteInt32VarLength ( int  value,
int  blockSize 
)
inline

Writes a variable length int32 value to the BitStream.

Parameters
valueThe int32 value to be written.
blockSizeThe block size to use.

◆ ReadInt64VarLength()

long Photon.Deterministic.BitStream.ReadInt64VarLength ( int  blockSize)
inline

Reads a variable-length 64-bit signed integer from the BitStream with the specified block size.

Parameters
blockSizeThe block size for reading the variable-length integer.
Returns
The read 64-bit signed integer.

◆ ReadInt32VarLength()

int Photon.Deterministic.BitStream.ReadInt32VarLength ( int  blockSize)
inline

Reads a variable-length 32-bit integer from the buffer.

Parameters
blockSizeThe block size used for encoding the integer.
Returns
The value of the read integer.

◆ ReadUInt32VarLength()

uint Photon.Deterministic.BitStream.ReadUInt32VarLength ( int  blockSize)
inline

Reads a variable length unsigned 32-bit integer from the BitStream.

Parameters
blockSizeThe size of each block of bits to read.
Returns
The value of the variable length unsigned 32-bit integer.

◆ ReadUInt64VarLength()

ulong Photon.Deterministic.BitStream.ReadUInt64VarLength ( int  blockSize)
inline

Reads an unsigned 64-bit integer with variable length from the BitStream.

Parameters
blockSizeThe number of bits in each block. Must be between 2 and 16 (inclusive).
Returns
The read value as an unsigned 64-bit integer.

◆ WriteUInt32VarLength()

void Photon.Deterministic.BitStream.WriteUInt32VarLength ( uint  value,
int  blockSize 
)
inline

Writes a variable-length unsigned 32-bit integer to the BitStream.

Parameters
valueThe value to write.
blockSizeThe number of bits per block. Must be between 2 and 16 (inclusive).

◆ WriteUInt64VarLength()

void Photon.Deterministic.BitStream.WriteUInt64VarLength ( ulong  value,
int  blockSize 
)
inline

Writes a UInt64 variable-length value to the BitStream using the specified blockSize.

Parameters
valueThe UInt64 value to write.
blockSizeThe size of each block in bits.

◆ WriteUInt() [1/2]

void Photon.Deterministic.BitStream.WriteUInt ( uint  value,
int  bits 
)
inline

Writes an unsigned integer value to the BitStream with the specified number of bits.

Parameters
valueThe value to write.
bitsThe number of bits to write.

◆ ReadUInt() [1/2]

uint Photon.Deterministic.BitStream.ReadUInt ( int  bits)
inline

Reads an unsigned integer from the BitStream with the specified number of bits.

Parameters
bitsThe number of bits to read.
Returns
The unsigned integer read from the BitStream.

◆ WriteUInt() [2/2]

void Photon.Deterministic.BitStream.WriteUInt ( uint  value)
inline

Writes an unsigned integer value of 32 bits to the bit stream.

Parameters
valueThe unsigned integer value to write.

◆ ReadUInt() [2/2]

uint Photon.Deterministic.BitStream.ReadUInt ( )
inline

Reads an unsigned 32-bit integer from the BitStream.

Returns
The unsigned 32-bit integer read from the BitStream.

◆ WriteInt_Shifted()

void Photon.Deterministic.BitStream.WriteInt_Shifted ( int  value,
int  bits,
int  shift 
)
inline

Writes an integer value to the BitStream with specified number of bits and a shift value.

Parameters
valueThe integer value to be written.
bitsThe number of bits to use to represent the integer value.
shiftThe shift value to apply to the integer value before writing.

◆ ReadInt_Shifted()

int Photon.Deterministic.BitStream.ReadInt_Shifted ( int  bits,
int  shift 
)
inline

Reads an integer value shifted by the specified amount of bits from the BitStream.

Parameters
bitsThe number of bits to read from the BitStream.
shiftThe amount of bits to shift the read value by.
Returns
The integer value read from the BitStream, shifted by the specified amount of bits.

◆ WriteInt() [1/2]

void Photon.Deterministic.BitStream.WriteInt ( int  value,
int  bits 
)
inline

Writes an integer value to the bitstream using the specified number of bits.

Parameters
valueThe integer value to be written to the bitstream.
bitsThe number of bits to use for writing the integer value.

◆ ReadInt() [1/2]

int Photon.Deterministic.BitStream.ReadInt ( int  bits)
inline

Reads an integer value from the bit stream.

Parameters
bitsThe number of bits to read.
Returns
The integer value read from the bit stream.

◆ WriteInt() [2/2]

void Photon.Deterministic.BitStream.WriteInt ( int  value)
inline

Writes an integer value to the BitStream using a specified number of bits.

Parameters
valueThe integer value to write

◆ ReadInt() [2/2]

int Photon.Deterministic.BitStream.ReadInt ( )
inline

Reads an integer value from the bit stream.

Returns
The integer value read from the bit stream.

◆ WriteULong() [1/2]

void Photon.Deterministic.BitStream.WriteULong ( ulong  value,
int  bits 
)
inline

Writes an unsigned long value to the bit stream. If the number of bits is less than or equal to 32, it writes the lower 32 bits of the value. Otherwise, it writes the lower 32 bits first, followed by the remaining bits.

Parameters
valueThe value to be written
bitsThe number of bits to write

◆ ReadULong() [1/2]

ulong Photon.Deterministic.BitStream.ReadULong ( int  bits)
inline

Reads an unsigned 64-bit integer (ulong) from the BitStream with the specified number of bits. If the specified number of bits is less than or equal to 32, it reads an unsigned 32-bit integer (uint) instead.

Parameters
bitsThe number of bits to read.
Returns
The value read from the BitStream.

◆ WriteULong() [2/2]

void Photon.Deterministic.BitStream.WriteULong ( ulong  value)
inline

Writes an unsigned long value to the bit stream using a specified number of bits.

Parameters
valueThe unsigned long value to write.

◆ ReadULong() [2/2]

ulong Photon.Deterministic.BitStream.ReadULong ( )
inline

Reads an unsigned 64-bit integer from the BitStream.

Returns
The unsigned 64-bit integer read from the BitStream.

◆ WriteLong() [1/2]

void Photon.Deterministic.BitStream.WriteLong ( long  value,
int  bits 
)
inline

Writes a long value to the BitStream with the specified number of bits.

Parameters
valueThe long value to write.
bitsThe number of bits to use for encoding the value.

◆ ReadLong() [1/2]

long Photon.Deterministic.BitStream.ReadLong ( int  bits)
inline

Reads a long value from the BitStream with the specified number of bits.

Parameters
bitsThe number of bits to read.
Returns
The long value read from the BitStream.

◆ WriteLong() [2/2]

void Photon.Deterministic.BitStream.WriteLong ( long  value)
inline

Writes a long value to the BitStream.

Parameters
valueThe long value to write.

◆ ReadLong() [2/2]

long Photon.Deterministic.BitStream.ReadLong ( )
inline

Reads a long integer from the BitStream.

Returns
The long integer value.

◆ WriteFloat()

void Photon.Deterministic.BitStream.WriteFloat ( float  value)
inline

Writes a single-precision floating-point value to the BitStream.

Parameters
valueThe value to be written.

◆ ReadFloat()

float Photon.Deterministic.BitStream.ReadFloat ( )
inline

Reads a single-precision floating-point number from the BitStream.

Returns
The single-precision floating-point number read from the BitStream.

◆ WriteDouble()

void Photon.Deterministic.BitStream.WriteDouble ( double  value)
inline

Writes a double value to the bit stream.

Parameters
valueThe double value to write.

◆ ReadDouble()

double Photon.Deterministic.BitStream.ReadDouble ( )
inline

Reads a double value from the bit stream.

Returns
The double value read from the bit stream.

◆ WriteByteArray() [1/3]

void Photon.Deterministic.BitStream.WriteByteArray ( byte[]  from)
inline

Writes a byte array to the BitStream.

Parameters
fromThe byte array to write

◆ WriteByteArray() [2/3]

void Photon.Deterministic.BitStream.WriteByteArray ( byte[]  from,
int  count 
)
inline

Writes a byte array to the BitStream starting from a specified offset and writing a specified number of bytes.

Parameters
fromThe byte array to write from.
countThe number of bytes to write.

◆ WriteByteArray() [3/3]

void Photon.Deterministic.BitStream.WriteByteArray ( byte[]  from,
int  offset,
int  count 
)
inline

Writes a byte array to the BitStream.

Parameters
fromThe byte array to write.
offsetThe starting index of the byte array to write.
countThe number of bytes to write from the byte array.

◆ ReadByteArray() [1/4]

byte [] Photon.Deterministic.BitStream.ReadByteArray ( int  size)
inline

Reads a byte array from the BitStream with the specified size.

Parameters
sizeThe size of the byte array to read.
Returns
The byte array read from the BitStream.

◆ ReadByteArray() [2/4]

void Photon.Deterministic.BitStream.ReadByteArray ( byte[]  to)
inline

Reads a byte array from the BitStream object.

Parameters
toThe byte array to read the data into.

◆ ReadByteArray() [3/4]

void Photon.Deterministic.BitStream.ReadByteArray ( byte[]  to,
int  count 
)
inline

Reads a byte array from the BitStream, starting from the current position.

Parameters
toThe array to read into.
countThe number of bytes to read.

◆ ReadByteArray() [4/4]

void Photon.Deterministic.BitStream.ReadByteArray ( byte[]  to,
int  offset,
int  count 
)
inline

Parameters
to
offset
count

◆ WriteByteArrayLengthPrefixed() [1/2]

void Photon.Deterministic.BitStream.WriteByteArrayLengthPrefixed ( byte[]  array)
inline

Writes a byte array to the BitStream with a length prefix.

Parameters
arrayThe byte array to write.

◆ WriteByteArrayLengthPrefixed() [2/2]

void Photon.Deterministic.BitStream.WriteByteArrayLengthPrefixed ( byte[]  array,
int  maxLength 
)
inline

Writes a byte array to the bit stream in a length-prefixed format.

Parameters
arrayThe byte array to write.
maxLengthThe maximum length of the byte array to write.

◆ ReadByteArrayLengthPrefixed()

byte [] Photon.Deterministic.BitStream.ReadByteArrayLengthPrefixed ( )
inline

Reads a byte array from the bit stream that is length prefixed.

Returns
The byte array read from the bit stream. Returns null if the length prefix is false.

◆ WriteString() [1/2]

void Photon.Deterministic.BitStream.WriteString ( string  value,
Encoding  encoding 
)
inline

Writes a string value to the BitStream using the specified encoding.

Parameters
valueThe string value to write.
encodingThe encoding to use.

◆ WriteString() [2/2]

void Photon.Deterministic.BitStream.WriteString ( string  value)
inline

Writes a string to the BitStream using the specified encoding.

Parameters
valueThe string to write to the BitStream.

◆ ReadString() [1/2]

string Photon.Deterministic.BitStream.ReadString ( Encoding  encoding)
inline

Reads a string from the bit stream using the specified encoding.

Parameters
encodingThe encoding used to decode the string.
Returns
The string value.

◆ ReadString() [2/2]

string Photon.Deterministic.BitStream.ReadString ( )
inline

Reads a string from the BitStream using the specified encoding.

Returns
A string value read from the BitStream.

◆ WriteStringGZip()

void Photon.Deterministic.BitStream.WriteStringGZip ( String  value,
Encoding  encoding 
)
inline

Writes a string to the BitStream using GZip compression.

Parameters
valueThe string value to write.
encodingThe encoding to use when compressing the string.

◆ ReadStringGZip()

String Photon.Deterministic.BitStream.ReadStringGZip ( Encoding  encoding)
inline

Reads a compressed string from the BitStream using GZip decompression.

Parameters
encodingThe encoding to use for the string.
Returns
The decompressed string.

◆ WriteGuid()

void Photon.Deterministic.BitStream.WriteGuid ( Guid  guid)
inline

Writes a Guid to the BitStream.

Parameters
guidThe Guid to write.

◆ ReadGuid()

Guid Photon.Deterministic.BitStream.ReadGuid ( )
inline

Reads a Guid from the BitStream by reading 16 bytes and constructing a Guid object.

Returns
The Guid read from the BitStream.

◆ WriteFP()

void Photon.Deterministic.BitStream.WriteFP ( FP  fp)
inline

Writes the given fixed-point value to the bit stream.

Parameters
fpThe fixed-point value to write.

◆ ReadFP()

FP Photon.Deterministic.BitStream.ReadFP ( )
inline

The BitStream class is used for reading and writing data in a binary format.

This class provides methods for reading and writing various types of data, including integers, floats, and custom types such as FP (fixed-point), FPVector2, and FPVector3.

◆ WriteNullableFP()

void Photon.Deterministic.BitStream.WriteNullableFP ( FP  fp)
inline

Writes a nullable fixed-point value to the BitStream.

Parameters
fpThe nullable fixed-point value to write.

◆ WriteFPVector2()

void Photon.Deterministic.BitStream.WriteFPVector2 ( FPVector2  v)
inline

Writes an instance of FPVector2 to the BitStream.

Parameters
vThe FPVector2 instance to write.

◆ ReadFPVector2()

FPVector2 Photon.Deterministic.BitStream.ReadFPVector2 ( )
inline

Reads an FPVector2 from the current BitStream.

Returns
The read FPVector2.

◆ WriteFPVector3()

void Photon.Deterministic.BitStream.WriteFPVector3 ( FPVector3  v)
inline

Writes an FPVector3 to the BitStream.

Parameters
vThe FPVector3 value to write.

◆ ReadFPVector3()

FPVector3 Photon.Deterministic.BitStream.ReadFPVector3 ( )
inline

Reads a FPVector3 from the BitStream.

Returns
The read FPVector3.

◆ WriteFPQuaternion()

void Photon.Deterministic.BitStream.WriteFPQuaternion ( FPQuaternion  v)
inline

Writes a FPQuaternion value to the BitStream.

Parameters
vThe FPQuaternion value to write.

◆ ReadFPQuaternion()

FPQuaternion Photon.Deterministic.BitStream.ReadFPQuaternion ( )
inline

Reads and returns an instance of FPQuaternion from the current BitStream.

Returns
The read FPQuaternion.

◆ WriteFPMatrix2x2()

void Photon.Deterministic.BitStream.WriteFPMatrix2x2 ( FPMatrix2x2  v)
inline

Writes a FPMatrix2x2 to the BitStream.

Parameters
vThe FPMatrix2x2 to write.

◆ ReadFPMatrix2x2()

FPMatrix2x2 Photon.Deterministic.BitStream.ReadFPMatrix2x2 ( )
inline

Reads a 2x2 matrix of fixed-point numbers from the BitStream.

Returns
The 2x2 matrix of fixed-point numbers read from the BitStream.

◆ WriteFPMatrix3x3()

void Photon.Deterministic.BitStream.WriteFPMatrix3x3 ( FPMatrix3x3  v)
inline

Writes a 3x3 matrix of fixed-point numbers to the current instance of the BitStream.

Parameters
vThe FPMatrix3x3 to write.

◆ ReadFPMatrix3x3()

FPMatrix3x3 Photon.Deterministic.BitStream.ReadFPMatrix3x3 ( )
inline

Reads a 3x3 matrix of fixed-point numbers from the BitStream.

Returns
The read 3x3 matrix of fixed-point numbers.

/

◆ WriteFPMatrix4x4()

void Photon.Deterministic.BitStream.WriteFPMatrix4x4 ( FPMatrix4x4  v)
inline

Writes a 4x4 matrix of Fixed Point (FP) values to the bit stream.

Parameters
vThe 4x4 matrix of FP values to be written.

◆ ReadFPMatrix4x4()

FPMatrix4x4 Photon.Deterministic.BitStream.ReadFPMatrix4x4 ( )
inline

Reads a 4x4 matrix of Fixed Point numbers from the BitStream.

Returns
The read FPMatrix4x4 value.

◆ WriteFPBounds2()

void Photon.Deterministic.BitStream.WriteFPBounds2 ( FPBounds2  v)
inline

Writes an instance of FPBounds2 to the current BitStream object.

Parameters
vThe FPBounds2 instance to write.

◆ ReadFPBounds2()

FPBounds2 Photon.Deterministic.BitStream.ReadFPBounds2 ( )
inline

Reads an instance of FPBounds2 from the BitStream.

Returns
The read FPBounds2.

The method reads two instances of FPVector2 from the BitStream and assigns them to the corresponding fields of FPBounds2.

◆ WriteFPBounds3()

void Photon.Deterministic.BitStream.WriteFPBounds3 ( FPBounds3  v)
inline

Writes the FPBounds3 structure to the BitStream.

Parameters
vThe FPBounds3 structure to be written.

◆ ReadFPBounds3()

FPBounds3 Photon.Deterministic.BitStream.ReadFPBounds3 ( )
inline

Reads a FPBounds3 structure from the BitStream.

Returns
The FPBounds3 structure read from the BitStream.

◆ WriteByteAt()

static void Photon.Deterministic.BitStream.WriteByteAt ( byte[]  data,
int  ptr,
int  bits,
byte  value 
)
inlinestatic

Writes a byte value at the specified position in a byte array, considering the number of bits to be written for the value.

Parameters
dataThe byte array in which the value will be written.
ptrThe position in the byte array to write the value.
bitsThe number of bits to be written for the value.
valueThe byte value to be written.

◆ ArrayElementSerializer< T >()

delegate void Photon.Deterministic.BitStream.ArrayElementSerializer< T > ( ref T  element)

Represents a delegate for serializing an array element.

Template Parameters
TType of the array element.
Parameters
elementReference to the array element.

◆ Condition()

bool Photon.Deterministic.BitStream.Condition ( bool  condition)
inline

Serializes or deserializes a condition value.

Parameters
conditionThe condition value to serialize or deserialize.
Returns
The serialized or deserialized condition value.

◆ Serialize() [1/32]

void Photon.Deterministic.BitStream.Serialize ( ref String  value)
inline

Serializes or deserializes a string value.

Parameters
valueThe string value to serialize or deserialize.

◆ Serialize() [2/32]

void Photon.Deterministic.BitStream.Serialize ( ref bool  value)
inline

Serializes or deserializes a boolean value.

Parameters
valueThe boolean value to serialize or deserialize.

◆ Serialize() [3/32]

void Photon.Deterministic.BitStream.Serialize ( ref float  value)
inline

Serializes or deserializes a string value.

Parameters
valueThe string value to serialize or deserialize.

◆ Serialize() [4/32]

void Photon.Deterministic.BitStream.Serialize ( ref Double  value)
inline

Serializes or deserializes a Double value.

Parameters
valueThe Double value to serialize or deserialize.

◆ Serialize() [5/32]

void Photon.Deterministic.BitStream.Serialize ( ref Int64  value)
inline

Serializes or deserializes a 64-bit signed integer value.

Parameters
valueThe 64-bit signed integer value to serialize or deserialize.

◆ Serialize() [6/32]

void Photon.Deterministic.BitStream.Serialize ( ref UInt64  value)
inline

Serializes or deserializes a UInt64 value.

Parameters
valueThe UInt64 value to serialize or deserialize.

◆ Serialize() [7/32]

void Photon.Deterministic.BitStream.Serialize ( ref ushort  value)
inline

Serializes or deserializes a ushort (UInt16) value.

Parameters
valueThe value to serialize or deserialize.

◆ Serialize() [8/32]

void Photon.Deterministic.BitStream.Serialize ( ref FP  value)
inline

Serializes or deserializes an FP value.

Parameters
valueThe FP value to serialize or deserialize.

◆ Serialize() [9/32]

void Photon.Deterministic.BitStream.Serialize ( ref FPVector2  value)
inline

Serializes or deserializes a FPVector2 value.

Parameters
valueThe FPVector2 value to serialize or deserialize.

◆ Serialize() [10/32]

void Photon.Deterministic.BitStream.Serialize ( ref FPVector3  value)
inline

Serializes or deserializes a FPVector3 value.

Parameters
valueThe FPVector3 value to serialize or deserialize.

◆ Serialize() [11/32]

void Photon.Deterministic.BitStream.Serialize ( ref FPQuaternion  value)
inline

Serializes or deserializes an FPQuaternion value.

Parameters
valueThe FPQuaternion value to serialize or deserialize.

◆ Serialize() [12/32]

void Photon.Deterministic.BitStream.Serialize ( ref Byte  value)
inline

Serializes or deserializes a Byte value.

Parameters
valueThe value to serialize or deserialize.

◆ Serialize() [13/32]

void Photon.Deterministic.BitStream.Serialize ( ref uint  value)
inline

Serializes or deserializes a string value.

Parameters
valueThe string value to serialize or deserialize.

◆ Serialize() [14/32]

void Photon.Deterministic.BitStream.Serialize ( ref uint  value,
int  bits 
)
inline

Serializes or deserializes a given uint value.

Parameters
valueThe value to serialize or deserialize.
bitsThe number of bits to use for serialization or deserialization.

◆ Serialize() [15/32]

void Photon.Deterministic.BitStream.Serialize ( ref ulong  value,
int  bits 
)
inline

Serializes or deserializes a ulong value with a specified number of bits.

Parameters
valueThe ulong value to serialize or deserialize.
bitsThe number of bits to use for serialization or deserialization.

◆ Serialize() [16/32]

void Photon.Deterministic.BitStream.Serialize ( ref int  value)
inline

Serializes or deserializes a value of type int.

Parameters
valueThe value of type int to serialize or deserialize.

◆ Serialize() [17/32]

void Photon.Deterministic.BitStream.Serialize ( ref int  value,
int  bits 
)
inline

Serializes or deserializes a value of type int with the specified number of bits.

Parameters
valueThe int value to serialize or deserialize.
bitsThe number of bits used to represent the int value.

◆ Serialize() [18/32]

void Photon.Deterministic.BitStream.Serialize ( ref Int32[]  value)
inline

Serializes or deserializes an array of Int32 values.

Parameters
valueThe array of Int32 values to serialize or deserialize.

◆ Serialize() [19/32]

void Photon.Deterministic.BitStream.Serialize ( ref Byte[]  value)
inline

Serializes or deserializes a byte array.

Parameters
valueThe byte array to serialize or deserialize.

◆ SerializeAsByteArray()

void Photon.Deterministic.BitStream.SerializeAsByteArray ( BitStream  otherStream)
inline

Serializes the given BitStream as a byte array.

Parameters
otherStreamThe BitStream to be serialized.
Exceptions
NotImplementedExceptionThrown if the otherStream's Data array is null.

◆ Serialize() [20/32]

void Photon.Deterministic.BitStream.Serialize ( ref Byte[]  array,
ref Int32  length 
)
inline

Serializes or deserializes an array of bytes with a variable length.

Parameters
arrayThe array to serialize or deserialize.
lengthThe length of the array.

◆ Serialize() [21/32]

void Photon.Deterministic.BitStream.Serialize ( ref Byte[]  value,
Int32  fixedSize 
)
inline

Serializes or deserializes a fixed-sized byte array.

Parameters
valueThe byte array to serialize or deserialize.
fixedSizeThe fixed size of the byte array.

◆ Serialize() [22/32]

void Photon.Deterministic.BitStream.Serialize ( ref Byte[]  array,
ref Int32  length,
Int32  fixedSize 
)
inline

Serializes or deserializes a byte array with a fixed size.

Parameters
arrayThe byte array to serialize or deserialize.
lengthThe length of the byte array.
fixedSizeThe fixed size of the byte array.

◆ SerializeArrayLength< T >()

void Photon.Deterministic.BitStream.SerializeArrayLength< T > ( ref T[]  array)
inline

Serializes or deserializes the length of a generic array.

Template Parameters
TThe type of the elements in the array.
Parameters
arrayThe array to serialize or deserialize.

◆ SerializeArray< T >()

void Photon.Deterministic.BitStream.SerializeArray< T > ( ref T[]  array,
ArrayElementSerializer< T >  serializer 
)
inline

Serializes or deserializes an array using a custom serializer.

Template Parameters
TThe type of elements in the array.
Parameters
arrayThe array to serialize or deserialize.
serializerThe custom serializer for the array elements.

If write mode is enabled, the method serializes the length of the array, followed by each element of the array using the provided serializer. If write mode is disabled, the method deserializes the length of the array, creates a new array of the appropriate length, and populates the new array by deserializing each array element using the provided serializer.

◆ Serialize() [23/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( byte *  v)
inline

Serializes or deserializes a byte value.

Parameters
vThe byte value to serialize or deserialize.

◆ Serialize() [24/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( sbyte *  v)
inline

Serializes or deserializes a value.

Parameters
vThe value to serialize or deserialize.

◆ Serialize() [25/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( short *  v)
inline

Serializes or deserializes a short value.

Parameters
vPointer to the short value to serialize or deserialize.

◆ Serialize() [26/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( ushort *  v)
inline

Serializes or deserializes a ushort value.

Parameters
vThe ushort value to serialize or deserialize.

◆ Serialize() [27/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( int *  v)
inline

Serializes or deserializes a value of type int*.

Parameters
vThe pointer to the int value to serialize or deserialize.

◆ Serialize() [28/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( uint *  v)
inline

Serializes or deserializes a pointer to an unsigned integer.

Parameters
vThe pointer to an unsigned integer to serialize or deserialize.

◆ Serialize() [29/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( long *  v)
inline

Serializes or deserializes a long value.

Parameters
vA pointer to the long value to serialize or deserialize.

◆ Serialize() [30/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( ulong *  v)
inline

Serializes or deserializes the value pointed to by a ulong pointer.

Parameters
vThe ulong pointer to the value to serialize or deserialize.

◆ Serialize() [31/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( uint *  v,
int  bits 
)
inline

Serializes or deserializes a string value.

Parameters
vThe string value to serialize or deserialize.
bitsThe amount of bits to serialize or deserialize.

◆ Serialize() [32/32]

unsafe void Photon.Deterministic.BitStream.Serialize ( int *  v,
int  bits 
)
inline

Serializes or deserializes a value.

Parameters
vThe value to serialize or deserialize.
bitsThe number of bits to use for serialization.

◆ SerializeBuffer() [1/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( byte *  buffer,
int  length 
)
inline

Serializes or deserializes a buffer of bytes.

Parameters
bufferA pointer to the buffer of bytes to serialize or deserialize.
lengthThe length of the buffer.

If in write mode, the method writes each byte from the buffer to the stream. If in read mode, the method reads each byte from the stream and stores it in the buffer.

◆ SerializeBuffer() [2/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( sbyte *  buffer,
int  length 
)
inline

Serializes or deserializes a buffer of signed bytes.

Parameters
bufferThe buffer of signed bytes to serialize or deserialize.
lengthThe length of the buffer.

◆ SerializeBuffer() [3/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( short *  buffer,
int  length 
)
inline

Serializes or deserializes a buffer of type short.

Parameters
bufferThe buffer to serialize or deserialize.
lengthThe length of the buffer.

If _write is true, the method writes each element of the buffer to the bit stream. If _write is false, the method reads each element of the buffer from the bit stream.

◆ SerializeBuffer() [4/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( ushort *  buffer,
int  length 
)
inline

Serializes or deserializes a buffer of unsigned shorts.

Parameters
bufferThe buffer of unsigned shorts to serialize or deserialize.
lengthThe length of the buffer.

◆ SerializeBuffer() [5/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( int *  buffer,
int  length 
)
inline

Serializes or deserializes a buffer of integers.

Parameters
bufferThe buffer of integers to serialize or deserialize.
lengthThe length of the buffer.

◆ SerializeBuffer() [6/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( uint *  buffer,
int  length 
)
inline

Parameters
buffer
length

◆ SerializeBuffer() [7/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( long *  buffer,
int  length 
)
inline

Serializes or deserializes a buffer of long values.

Parameters
bufferThe buffer of long values to serialize or deserialize.
lengthThe length of the buffer.

◆ SerializeBuffer() [8/8]

unsafe void Photon.Deterministic.BitStream.SerializeBuffer ( ulong *  buffer,
int  length 
)
inline

Serializes or deserializes a buffer of ulong values.

Parameters
bufferA pointer to the buffer to serialize or deserialize.
lengthThe length of the buffer.

Property Documentation

◆ Position

int Photon.Deterministic.BitStream.Position
getset

Represents the position of the stream pointer in the BitStream.

◆ BytesRequired

int Photon.Deterministic.BitStream.BytesRequired
get

Gets the number of bytes required to represent the current position of the stream pointer in the BitStream.

This property is calculated based on the current position of the stream pointer in bits and converted to bytes.

◆ IsEvenBytes

bool Photon.Deterministic.BitStream.IsEvenBytes
get

Gets a value indicating whether the position of the stream pointer in the BitStream is aligned on even bytes.

The position of the stream pointer is considered to be aligned on even bytes if the remainder of division by 8 is 0. For example, if the value is 16, it is aligned on even bytes, but if the value is 17, it is not aligned on even bytes.

◆ Capacity

int Photon.Deterministic.BitStream.Capacity
get

Gets the capacity of the BitStream, in bytes.

The capacity of the BitStream, in bytes.

◆ Offset

int Photon.Deterministic.BitStream.Offset
get

Represents the offset in bytes from the beginning of the byte array in the BitStream.

◆ OffsetBits

int Photon.Deterministic.BitStream.OffsetBits
get

Represents the offset in bits from the start of the BitStream.

◆ Done

bool Photon.Deterministic.BitStream.Done
get

Gets a value indicating whether the stream pointer of the BitStream has reached the maximum pointer position.

◆ Overflowing

bool Photon.Deterministic.BitStream.Overflowing
get

Gets a value indicating whether the stream pointer of the BitStream has exceeded the maximum pointer position.

The Overflowing property returns true if the stream pointer is greater than the maximum pointer position, indicating that the stream has overflowed.

◆ DoneOrOverflow

bool Photon.Deterministic.BitStream.DoneOrOverflow
get

Indicates whether a bit stream is done (reached the end) or overflowing.

true if the bit stream is done or overflowing; otherwise, false.

◆ Writing

bool Photon.Deterministic.BitStream.Writing
getset

Represents the property indicating whether writing is enabled in the BitStream.

true if writing is enabled; otherwise, false.

◆ Reading

bool Photon.Deterministic.BitStream.Reading
getset

Gets or sets a value indicating whether the stream is in reading mode.

true if the stream is in reading mode; otherwise, false.

◆ Data

Byte [] Photon.Deterministic.BitStream.Data
get

Represents the data buffer used by the BitStream.