Skip to main content
Version: v1

ReadBuffer Class

Buffer class, used to sequentially read data. Used by tree code to reconstruct a tree from binary representation.

Signature​

export declare class ReadBuffer

Constructors​

ConstructorDescription
(constructor)(data)Constructs a new instance of the ReadBuffer class

Properties​

PropertyTypeDescription
bufferUint8Array
dataUint8Array
eofboolean
indexnumber
lengthnumber
posnumber

Methods​

MethodReturn TypeDescription
read(lengthArg)number
reset()void
skip(length)void
slice(start, end)Uint8Array

Constructor Details​

(constructor)​

Constructs a new instance of the ReadBuffer class

Signature​

constructor(data: Uint8Array);

Parameters​

ParameterTypeDescription
dataUint8Array

Property Details​

buffer​

Signature​

get buffer(): Uint8Array;

Type: Uint8Array

data​

Signature​

protected readonly data: Uint8Array;

Type: Uint8Array

eof​

Signature​

get eof(): boolean;

Type: boolean

index​

Signature​

protected index: number;

Type: number

length​

Signature​

get length(): number;

Type: number

pos​

Signature​

get pos(): number;

Type: number

Method Details​

read​

Signature​

read(lengthArg?: number): number;

Parameters​

ParameterModifiersTypeDescription
lengthArgoptionalnumber

Returns​

Return type: number

reset​

Signature​

reset(): void;

skip​

Signature​

skip(length: number): void;

Parameters​

ParameterTypeDescription
lengthnumber

slice​

Signature​

slice(start: number, end: number): Uint8Array;

Parameters​

ParameterTypeDescription
startnumber
endnumber

Returns​

Return type: Uint8Array