C# Class Lidgren.Network.NetBitWriter

Helper class for NetBuffer to write/read bits
Mostra file Open project: tomoprime/CrabBattle Class Usage Examples

Public Methods

Method Description
ReadByte ( byte fromBuffer, int numberOfBits, int readBitOffset ) : byte

Read 1-8 bits from a buffer into a byte

ReadBytes ( byte fromBuffer, int numberOfBytes, int readBitOffset, byte destination, int destinationByteOffset ) : void

Read several bytes from a buffer

ReadUInt32 ( byte fromBuffer, int numberOfBits, int readBitOffset ) : uint

Reads the specified number of bits into an UInt32

ReadVariableUInt32 ( byte buffer, int &offset ) : uint

Reads a UInt32 written using WriteUnsignedVarInt(); will increment offset!

WriteByte ( byte source, int numberOfBits, byte destination, int destBitOffset ) : void

Write a byte consisting of 1-8 bits to a buffer; assumes buffer is previously allocated

WriteBytes ( byte source, int sourceByteOffset, int numberOfBytes, byte destination, int destBitOffset ) : void

Write several whole bytes

WriteUInt32 ( uint source, int numberOfBits, byte destination, int destinationBitOffset ) : int

Writes the specified number of bits into a byte array

WriteUInt64 ( ulong source, int numberOfBits, byte destination, int destinationBitOffset ) : int

Writes the specified number of bits into a byte array

WriteVariableUInt32 ( byte intoBuffer, int offset, uint value ) : int

Write Base128 encoded variable sized unsigned integer

Method Details

ReadByte() public static method

Read 1-8 bits from a buffer into a byte
public static ReadByte ( byte fromBuffer, int numberOfBits, int readBitOffset ) : byte
fromBuffer byte
numberOfBits int
readBitOffset int
return byte

ReadBytes() public static method

Read several bytes from a buffer
public static ReadBytes ( byte fromBuffer, int numberOfBytes, int readBitOffset, byte destination, int destinationByteOffset ) : void
fromBuffer byte
numberOfBytes int
readBitOffset int
destination byte
destinationByteOffset int
return void

ReadUInt32() public static method

Reads the specified number of bits into an UInt32
public static ReadUInt32 ( byte fromBuffer, int numberOfBits, int readBitOffset ) : uint
fromBuffer byte
numberOfBits int
readBitOffset int
return uint

ReadVariableUInt32() public static method

Reads a UInt32 written using WriteUnsignedVarInt(); will increment offset!
public static ReadVariableUInt32 ( byte buffer, int &offset ) : uint
buffer byte
offset int
return uint

WriteByte() public static method

Write a byte consisting of 1-8 bits to a buffer; assumes buffer is previously allocated
public static WriteByte ( byte source, int numberOfBits, byte destination, int destBitOffset ) : void
source byte
numberOfBits int
destination byte
destBitOffset int
return void

WriteBytes() public static method

Write several whole bytes
public static WriteBytes ( byte source, int sourceByteOffset, int numberOfBytes, byte destination, int destBitOffset ) : void
source byte
sourceByteOffset int
numberOfBytes int
destination byte
destBitOffset int
return void

WriteUInt32() public static method

Writes the specified number of bits into a byte array
public static WriteUInt32 ( uint source, int numberOfBits, byte destination, int destinationBitOffset ) : int
source uint
numberOfBits int
destination byte
destinationBitOffset int
return int

WriteUInt64() public static method

Writes the specified number of bits into a byte array
public static WriteUInt64 ( ulong source, int numberOfBits, byte destination, int destinationBitOffset ) : int
source ulong
numberOfBits int
destination byte
destinationBitOffset int
return int

WriteVariableUInt32() public static method

Write Base128 encoded variable sized unsigned integer
public static WriteVariableUInt32 ( byte intoBuffer, int offset, uint value ) : int
intoBuffer byte
offset int
value uint
return int