Constructor
new Codec()
- Implements:
- Source:
Methods
decodeVarInt(bytesnon-null) → {bigint}
Decodes a variable-length integer from a slice holding exactly the bytes
of one encoded value, as reported by varIntLength().
Parameters:
| Name | Type | Description |
|---|---|---|
bytes |
Uint8Array |
- Implements:
- Source:
Returns:
- Type
- bigint
decodeVarIntAt(bytesnon-null, offset) → {Object}
Decodes the variable-length integer starting at the given offset within a
larger buffer, reporting how many bytes it consumed so the caller can
continue.
Parameters:
| Name | Type | Description |
|---|---|---|
bytes |
Uint8Array | |
offset |
number |
- Implements:
- Source:
Returns:
- Type
- Object
encodeVarInt(writernon-null, value)
Appends a variable-length integer to the writer.
Parameters:
| Name | Type | Description |
|---|---|---|
writer |
shaka.util.DataViewWriter | |
value |
bigint |
- Implements:
- Source:
varIntLength(firstByte) → {number}
Returns the total length in bytes of the variable-length integer that
starts with the given byte, so a reader knows how much to buffer before
decoding.
Parameters:
| Name | Type | Description |
|---|---|---|
firstByte |
number |
- Implements:
- Source:
Returns:
- Type
- number