A class that writes uint or struct to a byte array.
More...
|
static int | WriteEncodedUInt (byte[] output, int spaceAvailable, int offset, uint value) |
| Write a uint as an encoded value. More...
|
|
static int | WriteData< T > (byte[] output, int spaceAvailable, int offset, T data) |
| Write data to a byte array. More...
|
|
|
const uint | ENCODE_1BYTE = 127 |
|
const uint | ENCODE_2BYTE = 16383 |
|
const uint | ENCODE_4BYTE = 1073741823 |
|
A class that writes uint or struct to a byte array.
◆ WriteData< T >()
static int KS.Reactor.ksFixedDataWriter.WriteData< T > |
( |
byte[] |
output, |
|
|
int |
spaceAvailable, |
|
|
int |
offset, |
|
|
T |
data |
|
) |
| |
|
static |
Write data to a byte array.
- Template Parameters
-
- Parameters
-
output | Output byte array. |
spaceAvailable | Amount of space available for writing. |
offset | Offset to begin writing at. |
data | Data to write. |
- Returns
- Number of bytes written, or -1 on an error.
◆ WriteEncodedUInt()
static int KS.Reactor.ksFixedDataWriter.WriteEncodedUInt |
( |
byte[] |
output, |
|
|
int |
spaceAvailable, |
|
|
int |
offset, |
|
|
uint |
value |
|
) |
| |
|
static |
Write a uint as an encoded value.
This value must be less than 2^30 The lowest bit positions of the encoded value signal the number of bytes to read. If the value is less than or equal to 2^7-1, the first bit is a 0 and the value is placed in bits 1 to 7. If the value is less than or equal to 2^14-1, the first two bits are 01 and the value is placed in bits 2 to 15. If the value is less than or equal to 2^30-1, the first two bits are 11 and the value is placed in bits 2 to 31.
- Parameters
-
output | Output byte array. |
spaceAvailable | Amount of space available for writing. |
offset | Offset to begin writing at. |
value | Value to write. |
- Returns
- Number of bytes written, or -1 on an error