Photon Bolt Engine API 1.3

Public Member Functions | Public Attributes | Properties | List of all members
UdpKit.UdpPacket Class Reference
Inheritance diagram for UdpKit.UdpPacket:

Public Member Functions

bool CanRead ()
 Check if the Packet has 1 bit available for read More...
 
bool CanRead (int bits)
 Check if the Packet has N bit available for read More...
 
bool CanWrite ()
 Check if the Packet has 1 bit available for write More...
 
bool CanWrite (int bits)
 Check if the Packet has N bit available for write More...
 
void Dispose ()
 Dispose this UdpPacket and return it to the Pool More...
 
byte[] DuplicateData ()
 Get a copy of the internal buffer More...
 
bool ReadBool ()
 Read a bool from the buffer More...
 
byte ReadByte ()
 Read a byte from the buffer More...
 
byte ReadByte (int bits)
 Read a byte from the buffer More...
 
void ReadByteArray (byte[] to)
 Populate byte array with data from the internal buffer More...
 
void ReadByteArray (byte[] to, int count)
 Populate byte array with data from the internal buffer More...
 
void ReadByteArray (byte[] to, int offset, int count)
 Populate byte array with data from the internal buffer More...
 
byte[] ReadByteArray (int size)
 Read byte array from the buffer More...
 
byte[] ReadByteArrayWithPrefix ()
 Read a byte array with prefix More...
 
double ReadDouble ()
 Read a double from the buffer More...
 
UdpEndPoint ReadEndPoint ()
 Read an UdpEndPoint from the buffer More...
 
float ReadFloat ()
 Read a float from the buffer More...
 
Guid ReadGuid ()
 Read a GUID from the buffer More...
 
int ReadInt ()
 Read a int from the buffer More...
 
int ReadInt (int bits)
 Read a int from the buffer More...
 
int ReadInt_Shifted (int bits, int shift)
 Read an int value More...
 
long ReadLong ()
 Read a long from the buffer More...
 
long ReadLong (int bits)
 Read a long from the buffer More...
 
short ReadShort ()
 Read a short from the buffer More...
 
short ReadShort (int bits)
 Read a short from the buffer More...
 
string ReadString ()
 Read string from the buffer More...
 
string ReadString (Encoding encoding)
 Read string from the buffer More...
 
uint ReadUInt ()
 Read a uint from the buffer More...
 
uint ReadUInt (int bits)
 Read a uint from the buffer More...
 
ulong ReadULong ()
 Read a ulong from the buffer More...
 
ulong ReadULong (int bits)
 Read a ulong from the buffer More...
 
ushort ReadUShort ()
 Read a ushort from the buffer More...
 
ushort ReadUShort (int bits)
 Read a ushort from the buffer More...
 
void Serialize (ref int value, int bits)
 Serialize a int into the buffer if the Packet is in Write mode, or read from the buffer otherwise More...
 
void Serialize (ref uint value, int bits)
 Serialize a uint into the buffer if the Packet is in Write mode, or read from the buffer otherwise More...
 
override string ToString ()
 String version of UdpPacket More...
 
 UdpPacket (byte[] arr, int size, UdpPacketPool pool)
 
 UdpPacket (byte[] arr, UdpPacketPool pool)
 
 UdpPacket (UdpPacketPool pool)
 
bool WriteBool (bool value)
 Write a bool to the buffer More...
 
void WriteByte (byte value)
 Write a byte into the buffer More...
 
void WriteByte (byte value, int bits)
 Write a byte into the buffer More...
 
void WriteByteArray (byte[] from)
 Write a byte array into the buffer More...
 
void WriteByteArray (byte[] from, int count)
 Write a byte array into the buffer More...
 
void WriteByteArray (byte[] from, int offset, int count)
 Write a byte array into the buffer More...
 
void WriteByteArrayLengthPrefixed (byte[] array, int maxLength)
 Write a byte array into the buffer with a prefix to delimit its size More...
 
void WriteByteArrayWithPrefix (byte[] array)
 Write a byte array into the buffer with a prefix to delimit its size More...
 
void WriteDouble (double value)
 Write a double into the buffer More...
 
void WriteEndPoint (UdpEndPoint endpoint)
 Serialize an UdpEndPoint into the buffer More...
 
void WriteFloat (float value)
 Write a float into the buffer More...
 
void WriteGuid (Guid guid)
 Write a GUID into the buffer More...
 
void WriteInt (int value)
 Write a int into the buffer More...
 
void WriteInt (int value, int bits)
 Write a int into the buffer More...
 
void WriteInt_Shifted (int value, int bits, int shift)
 Write an int value More...
 
void WriteLong (long value)
 Write a long into the buffer More...
 
void WriteLong (long value, int bits)
 Write a long into the buffer More...
 
void WriteShort (short value)
 Write a short into the buffer More...
 
void WriteShort (short value, int bits)
 Write a short into the buffer More...
 
void WriteString (string value)
 Write a string into the buffer using UTF8 as Encoding More...
 
void WriteString (string value, Encoding encoding)
 Write a string into the buffer More...
 
void WriteString (string value, Encoding encoding, int length)
 Write a string into the buffer More...
 
void WriteUInt (uint value)
 Write a uint into the buffer More...
 
void WriteUInt (uint value, int bits)
 Write a uint into the buffer More...
 
void WriteULong (ulong value)
 Write a ulong into the buffer More...
 
void WriteULong (ulong value, int bits)
 Write a ulong into the buffer More...
 
void WriteUShort (ushort value)
 Write a ushort into the buffer More...
 
void WriteUShort (ushort value, int bits)
 Write a ushort into the buffer More...
 

Public Attributes

bool Write
 Signal if this package is writable More...
 

Properties

byte[] ByteBuffer [get]
 Buffer that will contain all Packet data More...
 
bool Done [get]
 Signal if this Packet is full. If its current UdpPacket.Position is equals to its total UdpPacket.Size More...
 
bool Overflowing [get]
 Signal if the packet is overflowing. If its current UdpPacket.Position is greater than its total UdpPacket.Size More...
 
int Position [get, set]
 Current position within the internal buffer More...
 
int Size [get, set]
 Total length in bits of the internal buffer More...
 
object UserToken [get, set]
 A user-assignable object More...
 

Constructor & Destructor Documentation

◆ UdpPacket() [1/3]

UdpKit.UdpPacket.UdpPacket ( UdpPacketPool  pool)
inline

◆ UdpPacket() [2/3]

UdpKit.UdpPacket.UdpPacket ( byte[]  arr,
UdpPacketPool  pool 
)
inline

◆ UdpPacket() [3/3]

UdpKit.UdpPacket.UdpPacket ( byte[]  arr,
int  size,
UdpPacketPool  pool 
)
inline

Member Function Documentation

◆ CanRead() [1/2]

bool UdpKit.UdpPacket.CanRead ( )
inline

Check if the Packet has 1 bit available for read

Returns
True if you can read 1 bit, false otherwise

◆ CanRead() [2/2]

bool UdpKit.UdpPacket.CanRead ( int  bits)
inline

Check if the Packet has N bit available for read

Parameters
bitsNumber of bits available to read
Returns
True if you can read N bit, false otherwise

◆ CanWrite() [1/2]

bool UdpKit.UdpPacket.CanWrite ( )
inline

Check if the Packet has 1 bit available for write

Returns
True if you can write 1 bit, false otherwise

◆ CanWrite() [2/2]

bool UdpKit.UdpPacket.CanWrite ( int  bits)
inline

Check if the Packet has N bit available for write

Parameters
bitsNumber of bits available to write
Returns
True if you can write N bit, false otherwise

◆ Dispose()

void UdpKit.UdpPacket.Dispose ( )
inline

Dispose this UdpPacket and return it to the Pool

◆ DuplicateData()

byte [] UdpKit.UdpPacket.DuplicateData ( )
inline

Get a copy of the internal buffer

Returns
Copy of data buffer

◆ ReadBool()

bool UdpKit.UdpPacket.ReadBool ( )
inline

Read a bool from the buffer

Returns
Bool value from the buffer

◆ ReadByte() [1/2]

byte UdpKit.UdpPacket.ReadByte ( )
inline

Read a byte from the buffer

Returns
Byte read

◆ ReadByte() [2/2]

byte UdpKit.UdpPacket.ReadByte ( int  bits)
inline

Read a byte from the buffer

Parameters
bitsNumber of bits to use when reading
Returns
Byte value

◆ ReadByteArray() [1/4]

void UdpKit.UdpPacket.ReadByteArray ( byte[]  to)
inline

Populate byte array with data from the internal buffer

Parameters
toByte array to be filled with data

◆ ReadByteArray() [2/4]

void UdpKit.UdpPacket.ReadByteArray ( byte[]  to,
int  count 
)
inline

Populate byte array with data from the internal buffer

Parameters
toByte array to be filled with data
countNumber of element to be read

◆ ReadByteArray() [3/4]

void UdpKit.UdpPacket.ReadByteArray ( byte[]  to,
int  offset,
int  count 
)
inline

Populate byte array with data from the internal buffer

Parameters
toByte array to be filled with data
offsetOffset from the beginning of the array
countNumber of element to be read

◆ ReadByteArray() [4/4]

byte [] UdpKit.UdpPacket.ReadByteArray ( int  size)
inline

Read byte array from the buffer

Parameters
sizeNumber of elements to read
Returns
Byte array extracted from the buffer

◆ ReadByteArrayWithPrefix()

byte [] UdpKit.UdpPacket.ReadByteArrayWithPrefix ( )
inline

Read a byte array with prefix

Returns
Byte array extracted from the buffer

◆ ReadDouble()

double UdpKit.UdpPacket.ReadDouble ( )
inline

Read a double from the buffer

Returns
Double value

◆ ReadEndPoint()

UdpEndPoint UdpKit.UdpPacket.ReadEndPoint ( )
inline

Read an UdpEndPoint from the buffer

Returns
UdpEndPoint value

◆ ReadFloat()

float UdpKit.UdpPacket.ReadFloat ( )
inline

Read a float from the buffer

Returns
Float value

◆ ReadGuid()

Guid UdpKit.UdpPacket.ReadGuid ( )
inline

Read a GUID from the buffer

Returns
GUID value

◆ ReadInt() [1/2]

int UdpKit.UdpPacket.ReadInt ( )
inline

Read a int from the buffer

Returns
Int value

◆ ReadInt() [2/2]

int UdpKit.UdpPacket.ReadInt ( int  bits)
inline

Read a int from the buffer

Parameters
bitsNumber of bits to use when reading
Returns
Int value

◆ ReadInt_Shifted()

int UdpKit.UdpPacket.ReadInt_Shifted ( int  bits,
int  shift 
)
inline

Read an int value

Parameters
bitsNumber of bits to read
shiftNumber of bits to shift
Returns
Int value

◆ ReadLong() [1/2]

long UdpKit.UdpPacket.ReadLong ( )
inline

Read a long from the buffer

Returns
Long value

◆ ReadLong() [2/2]

long UdpKit.UdpPacket.ReadLong ( int  bits)
inline

Read a long from the buffer

Parameters
bitsNumber of bits to use when reading
Returns
Long value

◆ ReadShort() [1/2]

short UdpKit.UdpPacket.ReadShort ( )
inline

Read a short from the buffer

Returns
Short value

◆ ReadShort() [2/2]

short UdpKit.UdpPacket.ReadShort ( int  bits)
inline

Read a short from the buffer

Parameters
bitsNumber of bits to use when reading
Returns
Short value

◆ ReadString() [1/2]

string UdpKit.UdpPacket.ReadString ( )
inline

Read string from the buffer

Returns
String value

◆ ReadString() [2/2]

string UdpKit.UdpPacket.ReadString ( Encoding  encoding)
inline

Read string from the buffer

Parameters
encodingString encoding
Returns
String value

◆ ReadUInt() [1/2]

uint UdpKit.UdpPacket.ReadUInt ( )
inline

Read a uint from the buffer

Returns
UInt value

◆ ReadUInt() [2/2]

uint UdpKit.UdpPacket.ReadUInt ( int  bits)
inline

Read a uint from the buffer

Parameters
bitsNumber of bits to use when reading
Returns
UInt value

◆ ReadULong() [1/2]

ulong UdpKit.UdpPacket.ReadULong ( )
inline

Read a ulong from the buffer

Returns
ULong value

◆ ReadULong() [2/2]

ulong UdpKit.UdpPacket.ReadULong ( int  bits)
inline

Read a ulong from the buffer

Parameters
bitsNumber of bits to use when reading
Returns
ULong value

◆ ReadUShort() [1/2]

ushort UdpKit.UdpPacket.ReadUShort ( )
inline

Read a ushort from the buffer

Returns
UShort value

◆ ReadUShort() [2/2]

ushort UdpKit.UdpPacket.ReadUShort ( int  bits)
inline

Read a ushort from the buffer

Parameters
bitsNumber of bits to use when reading
Returns
UShort value

◆ Serialize() [1/2]

void UdpKit.UdpPacket.Serialize ( ref int  value,
int  bits 
)
inline

Serialize a int into the buffer if the Packet is in Write mode, or read from the buffer otherwise

Parameters
valueInt value to be written or read
bitsNumber of bits to use when writing or reading

◆ Serialize() [2/2]

void UdpKit.UdpPacket.Serialize ( ref uint  value,
int  bits 
)
inline

Serialize a uint into the buffer if the Packet is in Write mode, or read from the buffer otherwise

Parameters
valueUInt value to be written or read
bitsNumber of bits to use when writing or reading

◆ ToString()

override string UdpKit.UdpPacket.ToString ( )
inline

String version of UdpPacket

Returns
String value

◆ WriteBool()

bool UdpKit.UdpPacket.WriteBool ( bool  value)
inline

Write a bool to the buffer

Parameters
valueBool to be written
Returns
The bool value written

◆ WriteByte() [1/2]

void UdpKit.UdpPacket.WriteByte ( byte  value)
inline

Write a byte into the buffer

Parameters
valueByte to be written

◆ WriteByte() [2/2]

void UdpKit.UdpPacket.WriteByte ( byte  value,
int  bits 
)
inline

Write a byte into the buffer

Parameters
valueByte value to write
bitsNumber of bits to use when writing

◆ WriteByteArray() [1/3]

void UdpKit.UdpPacket.WriteByteArray ( byte[]  from)
inline

Write a byte array into the buffer

Parameters
fromByte array to be written

◆ WriteByteArray() [2/3]

void UdpKit.UdpPacket.WriteByteArray ( byte[]  from,
int  count 
)
inline

Write a byte array into the buffer

Parameters
fromByte array to be written
countNumber of elements to be written

◆ WriteByteArray() [3/3]

void UdpKit.UdpPacket.WriteByteArray ( byte[]  from,
int  offset,
int  count 
)
inline

Write a byte array into the buffer

Parameters
fromByte array to be written
offsetOffset from the beginning of the array
countNumber of elements to be written

◆ WriteByteArrayLengthPrefixed()

void UdpKit.UdpPacket.WriteByteArrayLengthPrefixed ( byte[]  array,
int  maxLength 
)
inline

Write a byte array into the buffer with a prefix to delimit its size

Parameters
arrayByte array to be written
maxLengthMax length of the array

◆ WriteByteArrayWithPrefix()

void UdpKit.UdpPacket.WriteByteArrayWithPrefix ( byte[]  array)
inline

Write a byte array into the buffer with a prefix to delimit its size

Parameters
arrayByte array to be written

◆ WriteDouble()

void UdpKit.UdpPacket.WriteDouble ( double  value)
inline

Write a double into the buffer

Parameters
valueDouble value to be written

◆ WriteEndPoint()

void UdpKit.UdpPacket.WriteEndPoint ( UdpEndPoint  endpoint)
inline

Serialize an UdpEndPoint into the buffer

Parameters
endpointEndPoint to be written

◆ WriteFloat()

void UdpKit.UdpPacket.WriteFloat ( float  value)
inline

Write a float into the buffer

Parameters
valueFloat value to be written

◆ WriteGuid()

void UdpKit.UdpPacket.WriteGuid ( Guid  guid)
inline

Write a GUID into the buffer

Parameters
guidGUID to be written

◆ WriteInt() [1/2]

void UdpKit.UdpPacket.WriteInt ( int  value)
inline

Write a int into the buffer

Parameters
valueUInt value to be written

◆ WriteInt() [2/2]

void UdpKit.UdpPacket.WriteInt ( int  value,
int  bits 
)
inline

Write a int into the buffer

Parameters
valueInt value to be written
bitsNumber of bits to use when writing

◆ WriteInt_Shifted()

void UdpKit.UdpPacket.WriteInt_Shifted ( int  value,
int  bits,
int  shift 
)
inline

Write an int value

Parameters
valueValue to be written
bitsNumber of bits to write
shiftNumber of bits to shift

◆ WriteLong() [1/2]

void UdpKit.UdpPacket.WriteLong ( long  value)
inline

Write a long into the buffer

Parameters
valueLong value to be written

◆ WriteLong() [2/2]

void UdpKit.UdpPacket.WriteLong ( long  value,
int  bits 
)
inline

Write a long into the buffer

Parameters
valueLong value to be written
bitsNumber of bits to use when writing

◆ WriteShort() [1/2]

void UdpKit.UdpPacket.WriteShort ( short  value)
inline

Write a short into the buffer

Parameters
valueShort value to be written

◆ WriteShort() [2/2]

void UdpKit.UdpPacket.WriteShort ( short  value,
int  bits 
)
inline

Write a short into the buffer

Parameters
valueShort value to be written
bitsNumber of bits to use when writing

◆ WriteString() [1/3]

void UdpKit.UdpPacket.WriteString ( string  value)
inline

Write a string into the buffer using UTF8 as Encoding

Parameters
valueString value to be written

◆ WriteString() [2/3]

void UdpKit.UdpPacket.WriteString ( string  value,
Encoding  encoding 
)
inline

Write a string into the buffer

Parameters
valueString value to be written
encodingString encoding

◆ WriteString() [3/3]

void UdpKit.UdpPacket.WriteString ( string  value,
Encoding  encoding,
int  length 
)
inline

Write a string into the buffer

Parameters
valueString value to be written
encodingString encoding
lengthMax length of the string to be written

◆ WriteUInt() [1/2]

void UdpKit.UdpPacket.WriteUInt ( uint  value)
inline

Write a uint into the buffer

Parameters
valueUInt value to be written

◆ WriteUInt() [2/2]

void UdpKit.UdpPacket.WriteUInt ( uint  value,
int  bits 
)
inline

Write a uint into the buffer

Parameters
valueUInt value to be written
bitsNumber of bits to use when writing

◆ WriteULong() [1/2]

void UdpKit.UdpPacket.WriteULong ( ulong  value)
inline

Write a ulong into the buffer

Parameters
valueULong value to be written

◆ WriteULong() [2/2]

void UdpKit.UdpPacket.WriteULong ( ulong  value,
int  bits 
)
inline

Write a ulong into the buffer

Parameters
valueULong value to be written
bitsNumber of bits to use when writing

◆ WriteUShort() [1/2]

void UdpKit.UdpPacket.WriteUShort ( ushort  value)
inline

Write a ushort into the buffer

Parameters
valueUShort to be written

◆ WriteUShort() [2/2]

void UdpKit.UdpPacket.WriteUShort ( ushort  value,
int  bits 
)
inline

Write a ushort into the buffer

Parameters
valueUShort to be written
bitsNumber of bits to use when writing

Member Data Documentation

◆ Write

bool UdpKit.UdpPacket.Write

Signal if this package is writable

Property Documentation

◆ ByteBuffer

byte [] UdpKit.UdpPacket.ByteBuffer
get

Buffer that will contain all Packet data

◆ Done

bool UdpKit.UdpPacket.Done
get

Signal if this Packet is full. If its current UdpPacket.Position is equals to its total UdpPacket.Size

◆ Overflowing

bool UdpKit.UdpPacket.Overflowing
get

Signal if the packet is overflowing. If its current UdpPacket.Position is greater than its total UdpPacket.Size

◆ Position

int UdpKit.UdpPacket.Position
getset

Current position within the internal buffer

◆ Size

int UdpKit.UdpPacket.Size
getset

Total length in bits of the internal buffer

◆ UserToken

object UdpKit.UdpPacket.UserToken
getset

A user-assignable object