Constructor
(export) new DataViewReader(dataViewnon-null, endianness)
Creates a DataViewReader, which abstracts a DataView object.
Parameters:
Name | Type | Description |
---|---|---|
dataView |
DataView | The DataView. |
endianness |
shaka.util.DataViewReader.Endianness | The endianness. |
- Source:
Members
(export, static) Endianness :number
Endianness.
Type:
- number
Properties:
Name | Value | Type | Description |
---|---|---|---|
BIG_ENDIAN |
0 | number | |
LITTLE_ENDIAN |
1 | number |
- Source:
(private, non-null) dataView_ :DataView
Type:
- DataView
- Source:
Methods
getDataView() → (non-null) {DataView}
- Source:
Returns:
The underlying DataView instance.
- Type
- DataView
(export) getLength() → {number}
Gets the byte length of the DataView.
- Source:
Returns:
- Type
- number
(export) getPosition() → {number}
Gets the current byte position.
- Source:
Returns:
- Type
- number
(export) hasMoreData() → {boolean}
- Source:
Returns:
True if the reader has more data, false otherwise.
- Type
- boolean
(export) readBytes(bytes) → (non-null) {Uint8Array}
Reads the specified number of raw bytes.
Parameters:
Name | Type | Description |
---|---|---|
bytes |
number | The number of bytes to read. |
- Source:
Throws:
-
when reading past the end of the data view.
- Type
- shaka.util.Error
Returns:
- Type
- Uint8Array
(export) readInt32() → {number}
Reads a signed 32 bit integer, and advances the reader.
- Source:
Throws:
-
when reading past the end of the data view.
- Type
- shaka.util.Error
Returns:
The integer.
- Type
- number
(export) 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
(export) readUint8() → {number}
Reads an unsigned 8 bit integer, and advances the reader.
- Source:
Throws:
-
when reading past the end of the data view.
- Type
- shaka.util.Error
Returns:
The integer.
- Type
- number
(export) readUint16() → {number}
Reads an unsigned 16 bit integer, and advances the reader.
- Source:
Throws:
-
when reading past the end of the data view.
- Type
- shaka.util.Error
Returns:
The integer.
- Type
- number
(export) readUint32() → {number}
Reads an unsigned 32 bit integer, and advances the reader.
- Source:
Throws:
-
when reading past the end of the data view.
- Type
- shaka.util.Error
Returns:
The integer.
- Type
- number
(export) readUint64() → {number}
Reads an unsigned 64 bit integer, and advances the reader.
- Source:
Throws:
-
when reading past the end of the data view or when reading an integer too large to store accurately in JavaScript.
- Type
- shaka.util.Error
Returns:
The integer.
- Type
- number
(export) rewind(bytes)
Rewinds the specified number of bytes.
Parameters:
Name | Type | Description |
---|---|---|
bytes |
number | The number of bytes to rewind. |
- Source:
Throws:
-
when rewinding past the beginning of the data view.
- Type
- shaka.util.Error
(export) seek(position)
Seeks to a specified position.
Parameters:
Name | Type | Description |
---|---|---|
position |
number | The desired byte position within the DataView. |
- Source:
Throws:
-
when seeking outside the range of the data view.
- Type
- shaka.util.Error
(export) skip(bytes)
Skips the specified number of bytes.
Parameters:
Name | Type | Description |
---|---|---|
bytes |
number | The number of bytes to skip. |
- Source:
Throws:
-
when skipping past the end of the data view.
- Type
- shaka.util.Error
(private) throwOutOfBounds_()
- Source: