A first-in-first-out (FIFO) bit packer that stores data in 4-byte chunks and can be manipulated on a bit level.
More...
|
void | LoadWritePos (int write, int original) |
|
void | SaveWritePos (out int write, out int original) |
|
void | LoadReadPos (int read) |
|
void | SaveReadPos (out int read) |
|
| BitPacker (int capacity=DEFAULT_CAPACITY, int stringCapacity=STRING_CAPACITY, int growMultiplier=GROW_MULTIPLIER, int growAddition=GROW_ADDITION) |
| Constructor.
|
|
void | Clear () |
| Resets the position cursors of the bit packer. Does not overwrite values.
|
|
int | PackNonAlloc (byte[] buffer) |
| Packs the content of the bit packer into the provided buffer and returns the size of the packed data in bytes. The size of the buffer should be at least the total original size of the data written into the bit packer.
|
|
byte[] | Pack () |
| Packs the content of the bit packer into a byte buffer.
|
|
byte[] | PackWithHeader () |
|
void | UnpackWithHeader (byte[] buffer) |
|
void | Unpack (byte[] buffer, int length) |
| Unpacks the provided byte buffer and loads the data into the bit packer overwriting the current content.
|
|
void | IncreaseOriginalSize (int bytes) |
| Increases original size counter.
|
|
void | Write (int numBits, uint value) |
| Takes the lower numBits from the value and stores them in the bit packer.
|
|
uint | Read (int numBits) |
| Reads the next numBits from the bit packer.
|
|
uint | Peek (int numBits) |
| Peeks at the next numBits from the bit packer.
|
|
uint | Peek (int numBits, int offsetBits) |
| Peeks at the next numBits from the bit packer using and offset.
|
|
void | Insert (int position, int numBits, uint value) |
| Inserts data at a given position into the bit packer.
|
|
void | WriteBool (bool value) |
| Writes a boolean value into the bit packer.
|
|
bool | ReadBool () |
| Reads a boolean value from the bit packer.
|
|
bool | PeekBool () |
| Peeks at the next boolean value from the bit packer.
|
|
void | WriteByte (byte value) |
| Writes a byte value into the bit packer.
|
|
byte | ReadByte () |
| Reads a byte value from the bit packer.
|
|
byte | PeekByte () |
| Peeks at the next byte value from the bit packer.
|
|
void | WriteInt (int value) |
| Writes an integer value into the bit packer.
|
|
int | ReadInt () |
| Reads an integer value from the bit packer.
|
|
int | PeekInt () |
| Peeks at the next integer value from the bit packer.
|
|
void | WriteUInt (uint value) |
| Writes an unsigned integer value into the bit packer.
|
|
uint | ReadUInt () |
| Reads an unsigned integer value from the bit packer.
|
|
uint | PeekUInt () |
| Peeks at the next unsigned integer value from the bit packer.
|
|
void | WriteFloat (float value) |
| Writes a single-precision floating-point value into the bit packer.
|
|
float | ReadFloat () |
| Reads a single-precision floating-point value from the bit packer.
|
|
float | PeekFloat () |
| Peeks at the next single-precision floating-point value from the bit packer.
|
|
void | WriteDouble (double value) |
| Writes a double-precision floating-point value into the bit packer.
|
|
double | ReadDouble () |
| Reads a double-precision floating-point value from the bit packer.
|
|
double | PeekDouble () |
| Peeks at the next double-precision floating-point value from the bit packer.
|
|
void | WriteLong (long value) |
| Writes a long value into the bit packer.
|
|
long | ReadLong () |
| Reads a long value from the bit packer.
|
|
long | PeekLong () |
| Peeks at the next long value from the bit packer.
|
|
void | WriteULong (ulong value) |
| Writes an unsigned long value into the bit packer.
|
|
ulong | ReadULong () |
| Reads an unsigned long value from the bit packer.
|
|
ulong | PeekULong () |
| Peeks at the next unsigned long value from the bit packer.
|
|
void | WriteBytes (byte[] value, int offset=0) |
| Writes a byte array into the bit packer.
|
|
void | WriteBytes (byte[] value, int offset, int numBytes) |
| Writes a byte array into the bit packer.
|
|
byte[] | ReadBytes (int offset, int numBytes) |
| Reads a byte array from the bit packer.
|
|
void | ReadBytes (byte[] value, int offset, int numBytes) |
| Reads a byte array from the bit packer.
|
|
byte[] | PeekBytes (int offset, int numBytes) |
| Peeks at the next numBytes from the bit packer.
|
|
void | PeekBytes (byte[] value, int offset, int numBytes) |
| Peeks at the next numBytes from the bit packer.
|
|
void | WriteStringASCII (string value) |
| Writes an ASCII string into the bit packer.
|
|
string | ReadStringASCII () |
| Reads an ASCII string from the bit packer.
|
|
string | PeekStringASCII () |
| Peeks at the next ASCII string from the bit packer.
|
|
void | WriteStringUTF8 (string value) |
| Writes an UTF8 string into the bit packer.
|
|
string | ReadStringUTF8 () |
| Reads an UTF8 string from the bit packer.
|
|
string | PeekStringUTF8 () |
| Peeks at the next UTF8 string from the bit packer.
|
|
void | WriteAll< T > (IList< T > collection, int offset=0) |
| Writes all items of the collection into the bit packer.
|
|
void | WriteAll< T > (IList< T > collection, int offset, int numElements) |
| Writes all items of the collection into the bit packer.
|
|
byte | WriteAllToSize< T > (int maxTotalBytes, int maxIndividualBytes, IList< T > collection, int offset=0) |
| Writes items of the collection into the bit packer that satisfy the specified size constraints. Max 255 elements.
|
|
byte | WriteAllToSize< T > (int maxTotalBytes, int maxIndividualBytes, IList< T > collection, int offset, int numElements) |
| Writes items of the collection into the bit packer that satisfy the specified size constraints. Max 255 elements.
|
|
T[] | ReadAll< T > () |
| Reads all items and allocates an array for them.
|
|
uint | ReadAllNonAlloc< T > (T[] collection, int offset=0) |
| Reads all items into a preallocated array and returns the item count.
|
|
override string | ToString () |
|
A first-in-first-out (FIFO) bit packer that stores data in 4-byte chunks and can be manipulated on a bit level.