#
Class: BinaryWriterPacks primitive types into a 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- BinaryWriter
#
Constructors#
constructornew BinaryWriter(): BinaryWriter
Returns: BinaryWriter
#
Properties#
values• Readonly
values: (string | number)[]
Defined in: system/binarywriter.ts:31
#
Methods#
toStringtoString(): string
Returns: string
Defined in: system/binarywriter.ts:34
#
writeDoublewriteDouble(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:38
#
writeFloatwriteFloat(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:43
#
writeInt16writeInt16(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:48
#
writeInt32writeInt32(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:53
#
writeInt8writeInt8(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:58
#
writeStringwriteString(value: string): void
#
Parameters:Name | Type |
---|---|
value | string |
Returns: void
Defined in: system/binarywriter.ts:63
#
writeUInt16writeUInt16(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:68
#
writeUInt32writeUInt32(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:73
#
writeUInt8writeUInt8(value: number): void
#
Parameters:Name | Type |
---|---|
value | number |
Returns: void
Defined in: system/binarywriter.ts:78