BinaryEncoder
A BinaryEncoder handles the encoding to an ArrayBuffer.
Constructor Summary
Public Constructor | ||
public |
|
Member Summary
Public Members | ||
public |
data: *[] |
|
public get |
length: * The current length of the encoded data. |
|
public get |
pos: * The current write pointer (the same as length). |
Method Summary
Public Methods | ||
public |
Create an ArrayBuffer. |
|
public |
Write two bytes as an unsigned integer at a specific location. |
|
public |
Write two bytes as an unsigned integer at a specific location. |
|
public |
Write one byte as an unsigned Integer at a specific location. |
|
public |
Write an ID at the current position. |
|
public |
writeUint16(num: number) Write two bytes as an unsigned integer. |
|
public |
writeUint32(num: number) Write two bytes as an unsigned integer |
|
public |
writeUint8(num: number) Write one byte as an unsigned integer. |
|
public |
writeVarString(str: String) Write a variable length string. |
|
public |
writeVarUint(num: number) Write a variable length unsigned integer. |
Public Constructors
public constructor() source
Public Members
public data: *[] source
Public Methods
public setUint16(pos: number, num: number) source
Write two bytes as an unsigned integer at a specific location.
public setUint32(pos: number, num: number) source
Write two bytes as an unsigned integer at a specific location.
public setUint8(pos: number, num: number) source
Write one byte as an unsigned Integer at a specific location.
public writeID(id: ID) source
Write an ID at the current position.
Params:
Name | Type | Attribute | Description |
id | ID | The ID that is to be written. |
public writeUint16(num: number) source
Write two bytes as an unsigned integer.
Params:
Name | Type | Attribute | Description |
num | number | The number that is to be encoded. |
public writeUint32(num: number) source
Write two bytes as an unsigned integer
Params:
Name | Type | Attribute | Description |
num | number | The number that is to be encoded. |
public writeUint8(num: number) source
Write one byte as an unsigned integer.
Params:
Name | Type | Attribute | Description |
num | number | The number that is to be encoded. |