Skip to main content

Class: BufferView

Base class for reading and writing binary data.

Extended by

Accessors

buffer

Get Signature

get buffer(): ArrayBuffer

Returns the underlying buffer

Returns

ArrayBuffer

Defined in

buffer-view.ts:75


view

Get Signature

get view(): DataView

Returns the underlying DataView instance

Returns

DataView

Defined in

buffer-view.ts:82


position

Get Signature

get position(): number

Returns the current offset in the buffer in bytes.

Returns

number

Defined in

buffer-view.ts:89

Constructors

new BufferView()

new BufferView(buffer: ArrayBuffer): BufferView

Creates a new buffer view.

Parameters

ParameterTypeDescription

buffer

ArrayBuffer

The buffer to read/write data from/to

Returns

BufferView

Defined in

buffer-view.ts:30

Methods

subarray()

subarray(start: number, end: number): Uint8Array

Returns a subarray of the buffer.

Parameters

ParameterTypeDescription

start

number

The start offset in bytes

end

number

The end offset in bytes

Returns

Uint8Array

The subarray

Remarks

The returned Uint8Array shares the same memory as the buffer.

Defined in

buffer-view.ts:46


seek()

seek(position: number): void

Seeks to a specific offset in the buffer.

Parameters

ParameterTypeDescription

position

number

The offset to seek to

Returns

void

Throws

RangeError if the position is out of bounds

Defined in

buffer-view.ts:55


skip()

skip(offset: number): void

Skips a number of bytes in the buffer.

Parameters

ParameterTypeDescription

offset

number

The number of bytes to skip

Returns

void

Throws

RangeError if the offset is out of bounds

Defined in

buffer-view.ts:68

Properties

PropertyModifierTypeDescriptionDefined in
_bufferprotectedArrayBufferThe underlying buffer.buffer-view.ts:9
_viewprotectedDataViewThe DataView instance to read data from the buffer.buffer-view.ts:14
_u8protectedUint8ArrayThe Uint8Array instance to read data from the buffer.buffer-view.ts:19
_offsetprotectednumberThe current offset in the buffer in bytes.buffer-view.ts:24