Class: BufferView
Base class for reading and writing binary data.
Extended by
Accessors
buffer
Get Signature
get buffer():
ArrayBuffer
Returns the underlying buffer
Returns
Defined in
view
Get Signature
get view():
DataView
Returns the underlying DataView instance
Returns
Defined in
position
Get Signature
get position():
number
Returns the current offset in the buffer in bytes.
Returns
number
Defined in
Constructors
new BufferView()
new BufferView(
buffer
:ArrayBuffer
):BufferView
Creates a new buffer view.
Parameters
Parameter | Type | Description |
---|---|---|
| The buffer to read/write data from/to |
Returns
Defined in
Methods
subarray()
subarray(
start
:number
,end
:number
):Uint8Array
Returns a subarray of the buffer.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The start offset in bytes |
|
| The end offset in bytes |
Returns
The subarray
Remarks
The returned Uint8Array shares the same memory as the buffer.
Defined in
seek()
seek(
position
:number
):void
Seeks to a specific offset in the buffer.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The offset to seek to |
Returns
void
Throws
RangeError if the position is out of bounds
Defined in
skip()
skip(
offset
:number
):void
Skips a number of bytes in the buffer.
Parameters
Parameter | Type | Description |
---|---|---|
|
| The number of bytes to skip |
Returns
void
Throws
RangeError if the offset is out of bounds
Defined in
Properties
Property | Modifier | Type | Description | Defined in |
---|---|---|---|---|
_buffer | protected | ArrayBuffer | The underlying buffer. | buffer-view.ts:9 |
_view | protected | DataView | The DataView instance to read data from the buffer. | buffer-view.ts:14 |
_u8 | protected | Uint8Array | The Uint8Array instance to read data from the buffer. | buffer-view.ts:19 |
_offset | protected | number | The current offset in the buffer in bytes. | buffer-view.ts:24 |