MCPcopy Create free account
hub / github.com/Tencent/libpag / readBytes

Method readBytes

web/lite/src/codec/utils/byte-array.ts:223–230  ·  view source on GitHub ↗
(length?: number)

Source from the content-addressed store, hash-verified

221 }
222
223 public readBytes(length?: number): ByteArray {
224 const len = length || this.length - this._position;
225 if (this._position > this.length - len) throw new Error(ErrorMessage.PAGDecodeError);
226 const newBuffer = this.dataView.buffer.slice(this._position, this._position + len);
227 this._position += len;
228 this.positonChanged();
229 return new ByteArray(newBuffer, this.littleEndian);
230 }
231
232 public readUBits(numBits: number): number {
233 const bitMasks: number[] = [0, 1, 3, 7, 15, 31, 63, 127, 255];

Callers 3

readBodyBytesFunction · 0.45
readTagsFunction · 0.45

Calls 1

positonChangedMethod · 0.95

Tested by

no test coverage detected