BinaryDecoder
A BinaryDecoder handles the decoding of an ArrayBuffer.
Constructor Summary
Public Constructor | ||
public |
constructor(buffer: Uint8Array | Buffer) |
Method Summary
Public Methods | ||
public |
clone(newPos: *): * Clone this decoder instance. |
|
public |
Look ahead without incrementing position. |
|
public |
peekVarString(): * Look ahead and read varString without incrementing position |
|
public |
readID(): * Read ID. |
|
public |
readUint32(): number Read 4 bytes as unsigned integer. |
|
public |
readUint8(): * Read one byte as unsigned integer. |
|
public |
Read string of variable length
|
|
public |
Read unsigned integer (32bit) with variable length. |
|
public |
skip8() Skip one byte, jump to the next position. |
Public Constructors
public constructor(buffer: Uint8Array | Buffer) source
Params:
Name | Type | Attribute | Description |
buffer | Uint8Array | Buffer | The binary data that this instance decodes. |
Public Members
public uint8arr: * source
Public Methods
public clone(newPos: *): * source
Clone this decoder instance. Optionally set a new position parameter.
Params:
Name | Type | Attribute | Description |
newPos | * |
|
Return:
* |
public peekUint8(): number source
Look ahead without incrementing position. to the next byte and read it as unsigned integer.
public peekVarString(): * source
Look ahead and read varString without incrementing position
Return:
* |
public readID(): * source
Read ID.
- If first varUint read is 0xFFFFFF a RootID is returned.
- Otherwise an ID is returned.
Return:
* | ID |
public readVarString(): String source
Read string of variable length
- varUint is used to store the length of the string