#
Class: BinaryReaderReads primitive types from a packed binary string.
example
// Write the valuesconst writer = new BinaryWriter();writer.writeUInt8(5);writer.writeUInt8(32);writer.writeUInt8(78);writer.writeUInt8(200);writer.writeUInt32(12345678);writer.writeString("hello");writer.writeUInt16(45000);
// Read the valuesconst binaryString = writer.toString();const reader = new BinaryReader(binaryString);const values: any[] = [];
values[0] = reader.readUInt8(); // 5values[1] = reader.readUInt8(); // 32values[2] = reader.readUInt8(); // 78values[3] = reader.readUInt8(); // 200values[4] = reader.readUInt32(); // 12345678values[5] = reader.readString(); // hellovalues[6] = reader.readUInt16(); // 45000
#
Hierarchy- BinaryReader
#
Constructors#
constructornew BinaryReader(binaryString: string): BinaryReader
#
Parameters:Name | Type |
---|---|
binaryString | string |
Returns: BinaryReader
Defined in: system/binaryreader.ts:32
#
Properties#
data• Readonly
data: string
Defined in: system/binaryreader.ts:31
#
Methods#
readread(fmt: string, size: number): any
#
Parameters:Name | Type |
---|---|
fmt | string |
size | number |
Returns: any
Defined in: system/binaryreader.ts:38
#
readDoublereadDouble(): number
Returns: number
Defined in: system/binaryreader.ts:47
#
readFloatreadFloat(): number
Returns: number
Defined in: system/binaryreader.ts:51
#
readInt16readInt16(): number
Returns: number
Defined in: system/binaryreader.ts:55
#
readInt32readInt32(): number
Returns: number
Defined in: system/binaryreader.ts:59
#
readInt8readInt8(): number
Returns: number
Defined in: system/binaryreader.ts:63
#
readStringreadString(): string
Returns: string
Defined in: system/binaryreader.ts:67
#
readUInt16readUInt16(): number
Returns: number
Defined in: system/binaryreader.ts:73
#
readUInt32readUInt32(): number
Returns: number
Defined in: system/binaryreader.ts:77
#
readUInt8readUInt8(): number
Returns: number
Defined in: system/binaryreader.ts:81