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

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

Properties

Property Type Description
buffer Uint8Array
data Uint8Array
eof boolean
index number
length number
pos number

Methods

Method Return Type Description
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

Parameter Type Description
data Uint8Array

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

Parameter Modifiers Type Description
lengthArg optional number

Returns

Return type: number

reset

Signature
reset(): void;

skip

Signature
skip(length: number): void;

Parameters

Parameter Type Description
length number

slice

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

Parameters

Parameter Type Description
start number
end number

Returns

Return type: Uint8Array