mirror of
https://github.com/codedread/bitjs
synced 2025-10-03 09:39:16 +02:00
Update to @returns in all jsdoc
This commit is contained in:
parent
bab0864bf8
commit
84514d1617
11 changed files with 57 additions and 57 deletions
|
@ -80,7 +80,7 @@ export class Untarrer extends UntarrerInternal {
|
|||
* as Transferable and sent to a Worker thread once start() is called.
|
||||
* @param {Object|string} options An optional object of options, or a string
|
||||
* representing where the path to the unarchiver script files.
|
||||
* @return {Unarchiver}
|
||||
* @returns {Unarchiver}
|
||||
*/
|
||||
export function getUnarchiver(ab, options = {}) {
|
||||
return getUnarchiverInternal(ab, createWorkerFn, options);
|
||||
|
|
|
@ -239,7 +239,7 @@ export class UnarchiveExtractEvent extends UnarchiveEvent {
|
|||
|
||||
/**
|
||||
* This method must be overridden by the subclass to return the script filename.
|
||||
* @return {string} The MIME type of the archive.
|
||||
* @returns {string} The MIME type of the archive.
|
||||
* @protected.
|
||||
*/
|
||||
getMIMEType() {
|
||||
|
@ -248,7 +248,7 @@ export class UnarchiveExtractEvent extends UnarchiveEvent {
|
|||
|
||||
/**
|
||||
* This method must be overridden by the subclass to return the script filename.
|
||||
* @return {string} The script filename.
|
||||
* @returns {string} The script filename.
|
||||
* @protected.
|
||||
*/
|
||||
getScriptFileName() {
|
||||
|
@ -287,7 +287,7 @@ export class UnarchiveExtractEvent extends UnarchiveEvent {
|
|||
/**
|
||||
* Create an UnarchiveEvent out of the object sent back from the Worker.
|
||||
* @param {Object} obj
|
||||
* @return {UnarchiveEvent}
|
||||
* @returns {UnarchiveEvent}
|
||||
* @private
|
||||
*/
|
||||
createUnarchiveEvent_(obj) {
|
||||
|
@ -437,7 +437,7 @@ export class UntarrerInternal extends Unarchiver {
|
|||
* @param {Function(string):Worker} createWorkerFn A function that creates a Worker from a script file.
|
||||
* @param {Object|string} options An optional object of options, or a string representing where
|
||||
* the path to the unarchiver script files.
|
||||
* @return {Unarchiver}
|
||||
* @returns {Unarchiver}
|
||||
*/
|
||||
export function getUnarchiverInternal(ab, createWorkerFn, options = {}) {
|
||||
if (ab.byteLength < 10) {
|
||||
|
|
|
@ -77,7 +77,7 @@ export class Untarrer extends UntarrerInternal {
|
|||
* as Transferable and sent to a Worker thread once start() is called.
|
||||
* @param {Object|string} options An optional object of options, or a string
|
||||
* representing where the path to the unarchiver script files.
|
||||
* @return {Unarchiver}
|
||||
* @returns {Unarchiver}
|
||||
*/
|
||||
export function getUnarchiver(ab, options = {}) {
|
||||
return getUnarchiverInternal(ab, createWorkerFn, options);
|
||||
|
|
|
@ -57,7 +57,7 @@ function InitCRC() {
|
|||
/**
|
||||
* @param {number} startCRC
|
||||
* @param {Uint8Array} arr
|
||||
* @return {number}
|
||||
* @returns {number}
|
||||
*/
|
||||
function CRC(startCRC, arr) {
|
||||
if (CRCTab[1] == 0) {
|
||||
|
@ -204,7 +204,7 @@ const VM_OpType = {
|
|||
* variables that use the above enums.
|
||||
* @param {Object} obj
|
||||
* @param {number} val
|
||||
* @return {string} The key/enum value as a string.
|
||||
* @returns {string} The key/enum value as a string.
|
||||
*/
|
||||
function findKeyForValue(obj, val) {
|
||||
for (let key in obj) {
|
||||
|
@ -248,7 +248,7 @@ class VM_PreparedOperand {
|
|||
this.Addr = null;
|
||||
};
|
||||
|
||||
/** @return {string} */
|
||||
/** @returns {string} */
|
||||
toString() {
|
||||
if (this.Type === null) {
|
||||
return 'Error: Type was null in VM_PreparedOperand';
|
||||
|
@ -278,7 +278,7 @@ class VM_PreparedCommand {
|
|||
this.Op2 = new VM_PreparedOperand();
|
||||
}
|
||||
|
||||
/** @return {string} */
|
||||
/** @returns {string} */
|
||||
toString(indent) {
|
||||
if (this.OpCode === null) {
|
||||
return 'Error: OpCode was null in VM_PreparedCommand';
|
||||
|
@ -319,7 +319,7 @@ class VM_PreparedProgram {
|
|||
this.FilteredData = null;
|
||||
}
|
||||
|
||||
/** @return {string} */
|
||||
/** @returns {string} */
|
||||
toString() {
|
||||
let s = '{\n Cmd: [\n';
|
||||
for (let i = 0; i < this.Cmd.length; ++i) {
|
||||
|
@ -471,7 +471,7 @@ class RarVM {
|
|||
|
||||
/**
|
||||
* @param {Uint8Array} code
|
||||
* @return {VM_StandardFilters}
|
||||
* @returns {VM_StandardFilters}
|
||||
*/
|
||||
isStandardFilter(code) {
|
||||
const codeCRC = (CRC(0xffffffff, code, code.length) ^ 0xffffffff) >>> 0;
|
||||
|
@ -574,7 +574,7 @@ class RarVM {
|
|||
|
||||
/**
|
||||
* @param {Array<VM_PreparedCommand>} preparedCodes
|
||||
* @return {boolean}
|
||||
* @returns {boolean}
|
||||
*/
|
||||
executeCode(preparedCodes) {
|
||||
let codeIndex = 0;
|
||||
|
@ -971,7 +971,7 @@ class RarVM {
|
|||
* Static function that reads in the next set of bits for the VM
|
||||
* (might return 4, 8, 16 or 32 bits).
|
||||
* @param {bitjs.io.BitStream} bstream A RTL bit stream.
|
||||
* @return {number} The value of the bits read.
|
||||
* @returns {number} The value of the bits read.
|
||||
*/
|
||||
static readData(bstream) {
|
||||
// Read in the first 2 bits.
|
||||
|
|
|
@ -90,7 +90,7 @@
|
|||
* bit7 of byte0, then jumps to bit0 of byte1, etc.
|
||||
* @param {number} n The number of bits to peek, must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {number} The peeked bits, as an unsigned number.
|
||||
* @returns {number} The peeked bits, as an unsigned number.
|
||||
*/
|
||||
peekBits_ltm(n, opt_movePointers) {
|
||||
const NUM = parseInt(n, 10);
|
||||
|
@ -148,7 +148,7 @@
|
|||
* bit0 of byte0, then goes to bit7 of byte1, etc.
|
||||
* @param {number} n The number of bits to peek. Must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {number} The peeked bits, as an unsigned number.
|
||||
* @returns {number} The peeked bits, as an unsigned number.
|
||||
*/
|
||||
peekBits_mtl(n, opt_movePointers) {
|
||||
const NUM = parseInt(n, 10);
|
||||
|
@ -211,7 +211,7 @@
|
|||
/**
|
||||
* Reads n bits out of the stream, consuming them (moving the bit pointer).
|
||||
* @param {number} n The number of bits to read. Must be a positive integer.
|
||||
* @return {number} The read bits, as an unsigned number.
|
||||
* @returns {number} The read bits, as an unsigned number.
|
||||
*/
|
||||
readBits(n) {
|
||||
return this.peekBits(n, true);
|
||||
|
@ -223,7 +223,7 @@
|
|||
* bits in the current byte.
|
||||
* @param {number} n The number of bytes to peek. Must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
peekBytes(n, opt_movePointers) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -276,7 +276,7 @@
|
|||
|
||||
/**
|
||||
* @param {number} n The number of bytes to read.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
readBytes(n) {
|
||||
return this.peekBytes(n, true);
|
||||
|
|
|
@ -93,7 +93,7 @@
|
|||
* Peeks at the next n bytes as an unsigned number but does not advance the
|
||||
* pointer.
|
||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||
* @return {number} The n bytes interpreted as an unsigned number.
|
||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||
*/
|
||||
peekNumber(n) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -134,7 +134,7 @@
|
|||
* Returns the next n bytes as an unsigned number (or -1 on error)
|
||||
* and advances the stream pointer n bytes.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The n bytes interpreted as an unsigned number.
|
||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||
*/
|
||||
readNumber(n) {
|
||||
const num = this.peekNumber(n);
|
||||
|
@ -147,7 +147,7 @@
|
|||
* Returns the next n bytes as a signed number but does not advance the
|
||||
* pointer.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The bytes interpreted as a signed number.
|
||||
* @returns {number} The bytes interpreted as a signed number.
|
||||
*/
|
||||
peekSignedNumber(n) {
|
||||
let num = this.peekNumber(n);
|
||||
|
@ -163,7 +163,7 @@
|
|||
/**
|
||||
* Returns the next n bytes as a signed number and advances the stream pointer.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The bytes interpreted as a signed number.
|
||||
* @returns {number} The bytes interpreted as a signed number.
|
||||
*/
|
||||
readSignedNumber(n) {
|
||||
const num = this.peekSignedNumber(n);
|
||||
|
@ -177,7 +177,7 @@
|
|||
* is true.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @param {boolean} movePointers Whether to move the pointers.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
peekBytes(n, movePointers) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -223,7 +223,7 @@
|
|||
/**
|
||||
* Reads the next n bytes as a sub-array.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
readBytes(n) {
|
||||
return this.peekBytes(n, true);
|
||||
|
@ -232,7 +232,7 @@
|
|||
/**
|
||||
* Peeks at the next n bytes as an ASCII string but does not advance the pointer.
|
||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||
* @return {string} The next n bytes as a string.
|
||||
* @returns {string} The next n bytes as a string.
|
||||
*/
|
||||
peekString(n) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -267,7 +267,7 @@
|
|||
* Returns the next n bytes as an ASCII string and advances the stream pointer
|
||||
* n bytes.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {string} The next n bytes as a string.
|
||||
* @returns {string} The next n bytes as a string.
|
||||
*/
|
||||
readString(n) {
|
||||
const strToReturn = this.peekString(n);
|
||||
|
@ -292,7 +292,7 @@
|
|||
|
||||
/**
|
||||
* Creates a new ByteStream from this ByteStream that can be read / peeked.
|
||||
* @return {ByteStream} A clone of this ByteStream.
|
||||
* @returns {ByteStream} A clone of this ByteStream.
|
||||
*/
|
||||
tee() {
|
||||
const clone = new ByteStream(this.bytes.buffer);
|
||||
|
|
|
@ -16,7 +16,7 @@ let loadingPromise = undefined;
|
|||
let api = undefined;
|
||||
|
||||
/**
|
||||
* @return {Promise<Object>} Returns the API object.
|
||||
* @returns {Promise<Object>} Returns the API object.
|
||||
*/
|
||||
function loadWebPShimApi() {
|
||||
if (api) { return Promise.resolve(api); }
|
||||
|
|
|
@ -94,7 +94,7 @@ bitjs.io.BitStream =
|
|||
* bit7 of byte0, then jumps to bit0 of byte1, etc.
|
||||
* @param {number} n The number of bits to peek, must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {number} The peeked bits, as an unsigned number.
|
||||
* @returns {number} The peeked bits, as an unsigned number.
|
||||
*/
|
||||
peekBits_ltm(n, opt_movePointers) {
|
||||
const NUM = parseInt(n, 10);
|
||||
|
@ -152,7 +152,7 @@ bitjs.io.BitStream =
|
|||
* bit0 of byte0, then goes to bit7 of byte1, etc.
|
||||
* @param {number} n The number of bits to peek. Must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {number} The peeked bits, as an unsigned number.
|
||||
* @returns {number} The peeked bits, as an unsigned number.
|
||||
*/
|
||||
peekBits_mtl(n, opt_movePointers) {
|
||||
const NUM = parseInt(n, 10);
|
||||
|
@ -215,7 +215,7 @@ bitjs.io.BitStream =
|
|||
/**
|
||||
* Reads n bits out of the stream, consuming them (moving the bit pointer).
|
||||
* @param {number} n The number of bits to read. Must be a positive integer.
|
||||
* @return {number} The read bits, as an unsigned number.
|
||||
* @returns {number} The read bits, as an unsigned number.
|
||||
*/
|
||||
readBits(n) {
|
||||
return this.peekBits(n, true);
|
||||
|
@ -227,7 +227,7 @@ bitjs.io.BitStream =
|
|||
* bits in the current byte.
|
||||
* @param {number} n The number of bytes to peek. Must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
peekBytes(n, opt_movePointers) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -280,7 +280,7 @@ bitjs.io.BitStream =
|
|||
|
||||
/**
|
||||
* @param {number} n The number of bytes to read.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
readBytes(n) {
|
||||
return this.peekBytes(n, true);
|
||||
|
|
|
@ -92,7 +92,7 @@ export const BitStream =
|
|||
* bit7 of byte0, then jumps to bit0 of byte1, etc.
|
||||
* @param {number} n The number of bits to peek, must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {number} The peeked bits, as an unsigned number.
|
||||
* @returns {number} The peeked bits, as an unsigned number.
|
||||
*/
|
||||
peekBits_ltm(n, opt_movePointers) {
|
||||
const NUM = parseInt(n, 10);
|
||||
|
@ -150,7 +150,7 @@ export const BitStream =
|
|||
* bit0 of byte0, then goes to bit7 of byte1, etc.
|
||||
* @param {number} n The number of bits to peek. Must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {number} The peeked bits, as an unsigned number.
|
||||
* @returns {number} The peeked bits, as an unsigned number.
|
||||
*/
|
||||
peekBits_mtl(n, opt_movePointers) {
|
||||
const NUM = parseInt(n, 10);
|
||||
|
@ -213,7 +213,7 @@ export const BitStream =
|
|||
/**
|
||||
* Reads n bits out of the stream, consuming them (moving the bit pointer).
|
||||
* @param {number} n The number of bits to read. Must be a positive integer.
|
||||
* @return {number} The read bits, as an unsigned number.
|
||||
* @returns {number} The read bits, as an unsigned number.
|
||||
*/
|
||||
readBits(n) {
|
||||
return this.peekBits(n, true);
|
||||
|
@ -225,7 +225,7 @@ export const BitStream =
|
|||
* bits in the current byte.
|
||||
* @param {number} n The number of bytes to peek. Must be a positive integer.
|
||||
* @param {boolean=} movePointers Whether to move the pointer, defaults false.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
peekBytes(n, opt_movePointers) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -278,7 +278,7 @@ export const BitStream =
|
|||
|
||||
/**
|
||||
* @param {number} n The number of bytes to read.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
readBytes(n) {
|
||||
return this.peekBytes(n, true);
|
||||
|
|
|
@ -97,7 +97,7 @@ bitjs.io.ByteStream =
|
|||
* Peeks at the next n bytes as an unsigned number but does not advance the
|
||||
* pointer.
|
||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||
* @return {number} The n bytes interpreted as an unsigned number.
|
||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||
*/
|
||||
peekNumber(n) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -138,7 +138,7 @@ bitjs.io.ByteStream =
|
|||
* Returns the next n bytes as an unsigned number (or -1 on error)
|
||||
* and advances the stream pointer n bytes.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The n bytes interpreted as an unsigned number.
|
||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||
*/
|
||||
readNumber(n) {
|
||||
const num = this.peekNumber(n);
|
||||
|
@ -151,7 +151,7 @@ bitjs.io.ByteStream =
|
|||
* Returns the next n bytes as a signed number but does not advance the
|
||||
* pointer.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The bytes interpreted as a signed number.
|
||||
* @returns {number} The bytes interpreted as a signed number.
|
||||
*/
|
||||
peekSignedNumber(n) {
|
||||
let num = this.peekNumber(n);
|
||||
|
@ -167,7 +167,7 @@ bitjs.io.ByteStream =
|
|||
/**
|
||||
* Returns the next n bytes as a signed number and advances the stream pointer.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The bytes interpreted as a signed number.
|
||||
* @returns {number} The bytes interpreted as a signed number.
|
||||
*/
|
||||
readSignedNumber(n) {
|
||||
const num = this.peekSignedNumber(n);
|
||||
|
@ -181,7 +181,7 @@ bitjs.io.ByteStream =
|
|||
* is true.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @param {boolean} movePointers Whether to move the pointers.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
peekBytes(n, movePointers) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -227,7 +227,7 @@ bitjs.io.ByteStream =
|
|||
/**
|
||||
* Reads the next n bytes as a sub-array.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
readBytes(n) {
|
||||
return this.peekBytes(n, true);
|
||||
|
@ -236,7 +236,7 @@ bitjs.io.ByteStream =
|
|||
/**
|
||||
* Peeks at the next n bytes as an ASCII string but does not advance the pointer.
|
||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||
* @return {string} The next n bytes as a string.
|
||||
* @returns {string} The next n bytes as a string.
|
||||
*/
|
||||
peekString(n) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -271,7 +271,7 @@ bitjs.io.ByteStream =
|
|||
* Returns the next n bytes as an ASCII string and advances the stream pointer
|
||||
* n bytes.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {string} The next n bytes as a string.
|
||||
* @returns {string} The next n bytes as a string.
|
||||
*/
|
||||
readString(n) {
|
||||
const strToReturn = this.peekString(n);
|
||||
|
@ -296,7 +296,7 @@ bitjs.io.ByteStream =
|
|||
|
||||
/**
|
||||
* Creates a new ByteStream from this ByteStream that can be read / peeked.
|
||||
* @return {ByteStream} A clone of this ByteStream.
|
||||
* @returns {ByteStream} A clone of this ByteStream.
|
||||
*/
|
||||
tee() {
|
||||
const clone = new ByteStream(this.bytes.buffer);
|
||||
|
|
|
@ -95,7 +95,7 @@ export const ByteStream =
|
|||
* Peeks at the next n bytes as an unsigned number but does not advance the
|
||||
* pointer.
|
||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||
* @return {number} The n bytes interpreted as an unsigned number.
|
||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||
*/
|
||||
peekNumber(n) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -136,7 +136,7 @@ export const ByteStream =
|
|||
* Returns the next n bytes as an unsigned number (or -1 on error)
|
||||
* and advances the stream pointer n bytes.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The n bytes interpreted as an unsigned number.
|
||||
* @returns {number} The n bytes interpreted as an unsigned number.
|
||||
*/
|
||||
readNumber(n) {
|
||||
const num = this.peekNumber(n);
|
||||
|
@ -149,7 +149,7 @@ export const ByteStream =
|
|||
* Returns the next n bytes as a signed number but does not advance the
|
||||
* pointer.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The bytes interpreted as a signed number.
|
||||
* @returns {number} The bytes interpreted as a signed number.
|
||||
*/
|
||||
peekSignedNumber(n) {
|
||||
let num = this.peekNumber(n);
|
||||
|
@ -165,7 +165,7 @@ export const ByteStream =
|
|||
/**
|
||||
* Returns the next n bytes as a signed number and advances the stream pointer.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {number} The bytes interpreted as a signed number.
|
||||
* @returns {number} The bytes interpreted as a signed number.
|
||||
*/
|
||||
readSignedNumber(n) {
|
||||
const num = this.peekSignedNumber(n);
|
||||
|
@ -179,7 +179,7 @@ export const ByteStream =
|
|||
* is true.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @param {boolean} movePointers Whether to move the pointers.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
peekBytes(n, movePointers) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -225,7 +225,7 @@ export const ByteStream =
|
|||
/**
|
||||
* Reads the next n bytes as a sub-array.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {Uint8Array} The subarray.
|
||||
* @returns {Uint8Array} The subarray.
|
||||
*/
|
||||
readBytes(n) {
|
||||
return this.peekBytes(n, true);
|
||||
|
@ -234,7 +234,7 @@ export const ByteStream =
|
|||
/**
|
||||
* Peeks at the next n bytes as an ASCII string but does not advance the pointer.
|
||||
* @param {number} n The number of bytes to peek at. Must be a positive integer.
|
||||
* @return {string} The next n bytes as a string.
|
||||
* @returns {string} The next n bytes as a string.
|
||||
*/
|
||||
peekString(n) {
|
||||
const num = parseInt(n, 10);
|
||||
|
@ -269,7 +269,7 @@ export const ByteStream =
|
|||
* Returns the next n bytes as an ASCII string and advances the stream pointer
|
||||
* n bytes.
|
||||
* @param {number} n The number of bytes to read. Must be a positive integer.
|
||||
* @return {string} The next n bytes as a string.
|
||||
* @returns {string} The next n bytes as a string.
|
||||
*/
|
||||
readString(n) {
|
||||
const strToReturn = this.peekString(n);
|
||||
|
@ -294,7 +294,7 @@ export const ByteStream =
|
|||
|
||||
/**
|
||||
* Creates a new ByteStream from this ByteStream that can be read / peeked.
|
||||
* @return {ByteStream} A clone of this ByteStream.
|
||||
* @returns {ByteStream} A clone of this ByteStream.
|
||||
*/
|
||||
tee() {
|
||||
const clone = new ByteStream(this.bytes.buffer);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue