Arci.Networking
Arci.Networking.Data.ByteBuffer Class Reference

Byffer to store byte stream More...

Inheritance diagram for Arci.Networking.Data.ByteBuffer:
Arci.Networking.Data.Packet

Public Member Functions

 ByteBuffer ()
 Creates new instance of writable ByteBuffer More...
 
void WriteGuidByteStreamInOrder (PacketGuid guid, params int[] indexes)
 Writes packet guid byte stream in specified order More...
 
void WriteGuidBitStreamInOrder (PacketGuid guid, params int[] indexes)
 Writes packet guid bit stream in specified order More...
 
void Write (PacketGuid guid)
 Writes packet guid into data stream More...
 
void Write (Guid guid)
 Writes guid into data stream More...
 
void Write (Guid guid, string format)
 Writes guid into data stream More...
 
void Write (DateTime dateTime)
 Writes datetime data into stream More...
 
void WriteBit (bool bit)
 Writes bit value to stream More...
 
void FlushBits ()
 Flushes bits from memory to stream More...
 
void ClearUnflushedBits ()
 Clears unflushed bits More...
 
bool ReadBit ()
 Reads 1 bit More...
 
UInt64 ReadBits (byte bitsCount)
 Reads exact number of bits and return result as a value More...
 
void Write (string val)
 Writes string value with ASCII encoding More...
 
void Write (string val, Encoding encoding)
 Writes string value More...
 
void Write (ByteBuffer buffer)
 Appends the whole storage of bytebuffer to this one More...
 
byte [] ReadBytes ()
 Reads multiple bytes based on length written in stream More...
 
byte [] ReadBytes (int length)
 Reads multiple bytes More...
 
string ReadString ()
 Reads string with ASCII encoding More...
 
string ReadString (Encoding encoding)
 Reads string More...
 
void ReadGuidByteStreamInOrder (PacketGuid guid, params int[] indexes)
 Reads guid byte stream in specified order More...
 
void ReadGuidBitStreamInOrder (PacketGuid guid, params int[] indexes)
 Reads guid bit stream in specified order More...
 
PacketGuid ReadPacketGuid ()
 Reads packet guid from data stream More...
 
Guid ReadGuid ()
 Reads guid from data stream More...
 
Guid ReadGuid (string format)
 Reads guid from data stream More...
 
DateTime ReadDateTime ()
 Reads datetime from data stream More...
 
void Write (byte[] val)
 Writes byte[] value to stream More...
 
void Dispose ()
 Disposes object More...
 
SByte ReadSByte ()
 Reads SByte value from stream More...
 
void Write (SByte val)
 Writes SByte value to stream More...
 
Int16 ReadInt16 ()
 Reads Int16 value from stream More...
 
void Write (Int16 val)
 Writes Int16 value to stream More...
 
Int32 ReadInt32 ()
 Reads Int32 value from stream More...
 
void Write (Int32 val)
 Writes Int32 value to stream More...
 
Int64 ReadInt64 ()
 Reads Int64 value from stream More...
 
void Write (Int64 val)
 Writes Int64 value to stream More...
 
Byte ReadByte ()
 Reads Byte value from stream More...
 
void Write (Byte val)
 Writes Byte value to stream More...
 
UInt16 ReadUInt16 ()
 Reads UInt16 value from stream More...
 
void Write (UInt16 val)
 Writes UInt16 value to stream More...
 
UInt32 ReadUInt32 ()
 Reads UInt32 value from stream More...
 
void Write (UInt32 val)
 Writes UInt32 value to stream More...
 
UInt64 ReadUInt64 ()
 Reads UInt64 value from stream More...
 
void Write (UInt64 val)
 Writes UInt64 value to stream More...
 
Single ReadSingle ()
 Reads Single value from stream More...
 
void Write (Single val)
 Writes Single value to stream More...
 
Double ReadDouble ()
 Reads Double value from stream More...
 
void Write (Double val)
 Writes Double value to stream More...
 
Decimal ReadDecimal ()
 Reads Decimal value from stream More...
 
void Write (Decimal val)
 Writes Decimal value to stream More...
 
void WriteBit (SByte bit)
 Writes 1 if SByte value is different from 0, otherwise writes 0 More...
 
void WriteBits (SByte value, byte bitsCount)
 Writes value with specified number of bits More...
 
void WriteBit (Int16 bit)
 Writes 1 if Int16 value is different from 0, otherwise writes 0 More...
 
void WriteBits (Int16 value, byte bitsCount)
 Writes value with specified number of bits More...
 
void WriteBit (Int32 bit)
 Writes 1 if Int32 value is different from 0, otherwise writes 0 More...
 
void WriteBits (Int32 value, byte bitsCount)
 Writes value with specified number of bits More...
 
void WriteBit (Int64 bit)
 Writes 1 if Int64 value is different from 0, otherwise writes 0 More...
 
void WriteBits (Int64 value, byte bitsCount)
 Writes value with specified number of bits More...
 
void WriteBit (Byte bit)
 Writes 1 if Byte value is different from 0, otherwise writes 0 More...
 
void WriteBits (Byte value, byte bitsCount)
 Writes value with specified number of bits More...
 
void WriteBit (UInt16 bit)
 Writes 1 if UInt16 value is different from 0, otherwise writes 0 More...
 
void WriteBits (UInt16 value, byte bitsCount)
 Writes value with specified number of bits More...
 
void WriteBit (UInt32 bit)
 Writes 1 if UInt32 value is different from 0, otherwise writes 0 More...
 
void WriteBits (UInt32 value, byte bitsCount)
 Writes value with specified number of bits More...
 
void WriteBit (UInt64 bit)
 Writes 1 if UInt64 value is different from 0, otherwise writes 0 More...
 
void WriteBits (UInt64 value, byte bitsCount)
 Writes value with specified number of bits More...
 

Public Attributes

byte [] Data => memoryStream.ToArray()
 Data in packet More...
 

Protected Member Functions

 ByteBuffer (byte[] data)
 Creates new instance of readable ByteBuffer More...
 
void Initialize ()
 Inicializes data in ByteBuffer More...
 

Detailed Description

Byffer to store byte stream

Constructor & Destructor Documentation

§ ByteBuffer() [1/2]

Arci.Networking.Data.ByteBuffer.ByteBuffer ( byte []  data)
inlineprotected

Creates new instance of readable ByteBuffer

Parameters
dataData to form ByteBuffer from

§ ByteBuffer() [2/2]

Arci.Networking.Data.ByteBuffer.ByteBuffer ( )
inline

Creates new instance of writable ByteBuffer

Member Function Documentation

§ ClearUnflushedBits()

void Arci.Networking.Data.ByteBuffer.ClearUnflushedBits ( )
inline

Clears unflushed bits

§ Dispose()

void Arci.Networking.Data.ByteBuffer.Dispose ( )
inline

Disposes object

§ FlushBits()

void Arci.Networking.Data.ByteBuffer.FlushBits ( )
inline

Flushes bits from memory to stream

§ Initialize()

void Arci.Networking.Data.ByteBuffer.Initialize ( )
inlineprotected

Inicializes data in ByteBuffer

§ ReadBit()

bool Arci.Networking.Data.ByteBuffer.ReadBit ( )
inline

Reads 1 bit

Returns
1 bit from stream

§ ReadBits()

UInt64 Arci.Networking.Data.ByteBuffer.ReadBits ( byte  bitsCount)
inline

Reads exact number of bits and return result as a value

Parameters
bitsCountBits to be read
Returns
Value represented by bits that have been read

§ ReadByte()

Byte Arci.Networking.Data.ByteBuffer.ReadByte ( )
inline

Reads Byte value from stream

Returns
Byte value from stream

§ ReadBytes() [1/2]

byte [] Arci.Networking.Data.ByteBuffer.ReadBytes ( )
inline

Reads multiple bytes based on length written in stream

Returns
Byte array from stream

§ ReadBytes() [2/2]

byte [] Arci.Networking.Data.ByteBuffer.ReadBytes ( int  length)
inline

Reads multiple bytes

Parameters
lengthBytes to be read
Returns
Byte array from stream

§ ReadDateTime()

DateTime Arci.Networking.Data.ByteBuffer.ReadDateTime ( )
inline

Reads datetime from data stream

Returns
DateTime object

§ ReadDecimal()

Decimal Arci.Networking.Data.ByteBuffer.ReadDecimal ( )
inline

Reads Decimal value from stream

Returns
Decimal value from stream

§ ReadDouble()

Double Arci.Networking.Data.ByteBuffer.ReadDouble ( )
inline

Reads Double value from stream

Returns
Double value from stream

§ ReadGuid() [1/2]

Guid Arci.Networking.Data.ByteBuffer.ReadGuid ( )

Reads guid from data stream

Returns
Guid object

§ ReadGuid() [2/2]

Guid Arci.Networking.Data.ByteBuffer.ReadGuid ( string  format)
inline

Reads guid from data stream

Parameters
formatGuid format
Returns
Guid object

§ ReadGuidBitStreamInOrder()

void Arci.Networking.Data.ByteBuffer.ReadGuidBitStreamInOrder ( PacketGuid  guid,
params int []  indexes 
)
inline

Reads guid bit stream in specified order

Parameters
guidGuid to store value from stream
indexesOrder

§ ReadGuidByteStreamInOrder()

void Arci.Networking.Data.ByteBuffer.ReadGuidByteStreamInOrder ( PacketGuid  guid,
params int []  indexes 
)
inline

Reads guid byte stream in specified order

Parameters
guidGuid to store value from stream
indexesOrder

§ ReadInt16()

Int16 Arci.Networking.Data.ByteBuffer.ReadInt16 ( )
inline

Reads Int16 value from stream

Returns
Int16 value from stream

§ ReadInt32()

Int32 Arci.Networking.Data.ByteBuffer.ReadInt32 ( )
inline

Reads Int32 value from stream

Returns
Int32 value from stream

§ ReadInt64()

Int64 Arci.Networking.Data.ByteBuffer.ReadInt64 ( )
inline

Reads Int64 value from stream

Returns
Int64 value from stream

§ ReadPacketGuid()

PacketGuid Arci.Networking.Data.ByteBuffer.ReadPacketGuid ( )
inline

Reads packet guid from data stream

Returns
Packet guid

§ ReadSByte()

SByte Arci.Networking.Data.ByteBuffer.ReadSByte ( )
inline

Reads SByte value from stream

Returns
SByte value from stream

§ ReadSingle()

Single Arci.Networking.Data.ByteBuffer.ReadSingle ( )
inline

Reads Single value from stream

Returns
Single value from stream

§ ReadString() [1/2]

string Arci.Networking.Data.ByteBuffer.ReadString ( )

Reads string with ASCII encoding

Returns
String in ASCII format

§ ReadString() [2/2]

string Arci.Networking.Data.ByteBuffer.ReadString ( Encoding  encoding)
inline

Reads string

Parameters
encodingEncoding type of string. If null provided then ASCII will be used
Returns
String in specified format

§ ReadUInt16()

UInt16 Arci.Networking.Data.ByteBuffer.ReadUInt16 ( )
inline

Reads UInt16 value from stream

Returns
UInt16 value from stream

§ ReadUInt32()

UInt32 Arci.Networking.Data.ByteBuffer.ReadUInt32 ( )
inline

Reads UInt32 value from stream

Returns
UInt32 value from stream

§ ReadUInt64()

UInt64 Arci.Networking.Data.ByteBuffer.ReadUInt64 ( )
inline

Reads UInt64 value from stream

Returns
UInt64 value from stream

§ Write() [1/19]

void Arci.Networking.Data.ByteBuffer.Write ( SByte  val)
inline

Writes SByte value to stream

Parameters
valValue to be written

§ Write() [2/19]

void Arci.Networking.Data.ByteBuffer.Write ( Int16  val)
inline

Writes Int16 value to stream

Parameters
valValue to be written

§ Write() [3/19]

void Arci.Networking.Data.ByteBuffer.Write ( Int32  val)
inline

Writes Int32 value to stream

Parameters
valValue to be written

§ Write() [4/19]

void Arci.Networking.Data.ByteBuffer.Write ( PacketGuid  guid)
inline

Writes packet guid into data stream

Parameters
guidGuid to be written

§ Write() [5/19]

void Arci.Networking.Data.ByteBuffer.Write ( Int64  val)
inline

Writes Int64 value to stream

Parameters
valValue to be written

§ Write() [6/19]

void Arci.Networking.Data.ByteBuffer.Write ( Guid  guid)

Writes guid into data stream

Parameters
guidGuid to be written

§ Write() [7/19]

void Arci.Networking.Data.ByteBuffer.Write ( Guid  guid,
string  format 
)
inline

Writes guid into data stream

Parameters
guidGuid to be written
formatGuid format

§ Write() [8/19]

void Arci.Networking.Data.ByteBuffer.Write ( Byte  val)
inline

Writes Byte value to stream

Parameters
valValue to be written

§ Write() [9/19]

void Arci.Networking.Data.ByteBuffer.Write ( DateTime  dateTime)
inline

Writes datetime data into stream

Parameters
dateTimeDateTime to be written

§ Write() [10/19]

void Arci.Networking.Data.ByteBuffer.Write ( UInt16  val)
inline

Writes UInt16 value to stream

Parameters
valValue to be written

§ Write() [11/19]

void Arci.Networking.Data.ByteBuffer.Write ( UInt32  val)
inline

Writes UInt32 value to stream

Parameters
valValue to be written

§ Write() [12/19]

void Arci.Networking.Data.ByteBuffer.Write ( UInt64  val)
inline

Writes UInt64 value to stream

Parameters
valValue to be written

§ Write() [13/19]

void Arci.Networking.Data.ByteBuffer.Write ( Single  val)
inline

Writes Single value to stream

Parameters
valValue to be written

§ Write() [14/19]

void Arci.Networking.Data.ByteBuffer.Write ( string  val)

Writes string value with ASCII encoding

Parameters
valValue to be written

§ Write() [15/19]

void Arci.Networking.Data.ByteBuffer.Write ( Double  val)
inline

Writes Double value to stream

Parameters
valValue to be written

§ Write() [16/19]

void Arci.Networking.Data.ByteBuffer.Write ( string  val,
Encoding  encoding 
)
inline

Writes string value

Parameters
valValue to be written
encodingEncoding type of string. If null provided then ASCII will be used

§ Write() [17/19]

void Arci.Networking.Data.ByteBuffer.Write ( ByteBuffer  buffer)
inline

Appends the whole storage of bytebuffer to this one

Parameters
bufferBuffer to be written

§ Write() [18/19]

void Arci.Networking.Data.ByteBuffer.Write ( Decimal  val)
inline

Writes Decimal value to stream

Parameters
valValue to be written

§ Write() [19/19]

void Arci.Networking.Data.ByteBuffer.Write ( byte []  val)
inline

Writes byte[] value to stream

Parameters
valValue to be written

§ WriteBit() [1/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( bool  bit)
inline

Writes bit value to stream

Parameters
bitValue to be written

§ WriteBit() [2/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( SByte  bit)
inline

Writes 1 if SByte value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBit() [3/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( Int16  bit)
inline

Writes 1 if Int16 value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBit() [4/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( Int32  bit)
inline

Writes 1 if Int32 value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBit() [5/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( Int64  bit)
inline

Writes 1 if Int64 value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBit() [6/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( Byte  bit)
inline

Writes 1 if Byte value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBit() [7/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( UInt16  bit)
inline

Writes 1 if UInt16 value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBit() [8/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( UInt32  bit)
inline

Writes 1 if UInt32 value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBit() [9/9]

void Arci.Networking.Data.ByteBuffer.WriteBit ( UInt64  bit)
inline

Writes 1 if UInt64 value is different from 0, otherwise writes 0

Parameters
bitValue to be written

§ WriteBits() [1/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( SByte  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteBits() [2/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( Int16  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteBits() [3/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( Int32  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteBits() [4/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( Int64  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteBits() [5/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( Byte  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteBits() [6/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( UInt16  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteBits() [7/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( UInt32  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteBits() [8/8]

void Arci.Networking.Data.ByteBuffer.WriteBits ( UInt64  value,
byte  bitsCount 
)
inline

Writes value with specified number of bits

Parameters
valueValue to be written
bitsCountNumber of bits that value should written with

§ WriteGuidBitStreamInOrder()

void Arci.Networking.Data.ByteBuffer.WriteGuidBitStreamInOrder ( PacketGuid  guid,
params int []  indexes 
)
inline

Writes packet guid bit stream in specified order

Parameters
guidGuid to be written
indexesOrder

§ WriteGuidByteStreamInOrder()

void Arci.Networking.Data.ByteBuffer.WriteGuidByteStreamInOrder ( PacketGuid  guid,
params int []  indexes 
)
inline

Writes packet guid byte stream in specified order

Parameters
guidGuid to be written
indexesOrder

Member Data Documentation

§ Data

byte [] Arci.Networking.Data.ByteBuffer.Data => memoryStream.ToArray()

Data in packet