Constructor
new DataViewReader(data, endianness)
DataViewReader abstracts a DataView object.
Parameters:
Name | Type | Description |
---|---|---|
data |
BufferSource | |
endianness |
shaka.util.DataViewReader.Endianness | The endianness. |
- Source:
Members
Endianness :number
Endianness.
Type:
- number
Properties:
Name | Value | Type | Description |
---|---|---|---|
BIG_ENDIAN |
0 | number | |
LITTLE_ENDIAN |
1 | number |
- Source:
Methods
getDataView() → {DataView}
- Source:
Returns:
The underlying DataView instance.
- Type
- DataView
getLength() → {number}
Gets the byte length of the DataView.
- Source:
Returns:
- Type
- number
getPosition() → {number}
Gets the current byte position.
- Source:
Returns:
- Type
- number
hasMoreData() → {boolean}
- Source:
Returns:
True if the reader has more data, false otherwise.
- Type
- boolean
readBytes(bytes, clone) → {Uint8Array}
Reads the specified number of raw bytes.
Parameters:
Name | Type | Description |
---|---|---|
bytes |
number | The number of bytes to read. |
clone |
boolean | True to clone the data into a new buffer, false to create a view on the existing buffer. Creating a view on the existing buffer will keep the entire buffer in memory so long as the view is reachable. Use false for temporary values, and true for values that need to outlive the underlying buffer. |
- Source:
Returns:
- Type
- Uint8Array
readInt32() → {number}
Reads a signed 32 bit integer, and advances the reader.
- Source:
Returns:
The integer.
- Type
- number
readTerminatedString() → {string}
Keeps reading until it reaches a byte that equals to zero. The text is
assumed to be UTF-8.
- Source:
Returns:
- Type
- string
readUint8() → {number}
Reads an unsigned 8 bit integer, and advances the reader.
- Source:
Returns:
The integer.
- Type
- number
readUint16() → {number}
Reads an unsigned 16 bit integer, and advances the reader.
- Source:
Returns:
The integer.
- Type
- number
readUint32() → {number}
Reads an unsigned 32 bit integer, and advances the reader.
- Source:
Returns:
The integer.
- Type
- number
readUint64() → {number}
Reads an unsigned 64 bit integer, and advances the reader.
- Source:
Returns:
The integer.
- Type
- number
rewind(bytes)
Rewinds the specified number of bytes.
Parameters:
Name | Type | Description |
---|---|---|
bytes |
number | The number of bytes to rewind. |
- Source:
seek(position)
Seeks to a specified position.
Parameters:
Name | Type | Description |
---|---|---|
position |
number | The desired byte position within the DataView. |
- Source:
skip(bytes)
Skips the specified number of bytes.
Parameters:
Name | Type | Description |
---|---|---|
bytes |
number | The number of bytes to skip. |
- Source: