* Get a number of bytes from the current position, or all remaining bytes. * * @param {number} [numBytes=null] * @returns {Uint8Array}
(numBytes=null)
| 44 | * @returns {Uint8Array} |
| 45 | */ |
| 46 | getBytes(numBytes=null) { |
| 47 | if (this.position > this.length) return undefined; |
| 48 | |
| 49 | const newPosition = numBytes !== null ? |
| 50 | this.position + numBytes : |
| 51 | this.length; |
| 52 | const bytes = this.bytes.slice(this.position, newPosition); |
| 53 | this.position = newPosition; |
| 54 | this.bitPos = 0; |
| 55 | return bytes; |
| 56 | } |
| 57 | |
| 58 | /** |
| 59 | * Interpret the following bytes as a string, stopping at the next null byte or |
no outgoing calls
no test coverage detected