MCPcopy Index your code
hub / github.com/awayjs/core / readBytes

Method readBytes

lib/utils/ByteArray.ts:99–114  ·  view source on GitHub ↗
(bytes: ByteArray, offset: number = 0, length: number = 0)

Source from the content-addressed store, hash-verified

97 }
98
99 public readBytes(bytes: ByteArray, offset: number = 0, length: number = 0): void {
100 if (length == null)
101 length = bytes.length;
102
103 bytes.ensureWriteableSpace(offset + length);
104
105 const byteView: Int8Array = new Int8Array(bytes.arraybytes);
106 const localByteView: Int8Array = new Int8Array(this.arraybytes);
107
108 byteView.set(localByteView.subarray(this.position, this.position + length), offset);
109
110 this.position += length;
111
112 if (length + offset > bytes.length)
113 bytes.length += (length + offset) - bytes.length;
114 }
115
116 public writeUnsignedByte(b: number): void {
117 this.ensureWriteableSpace(1);

Callers 2

constructorMethod · 0.95
ByteArrayTestFunction · 0.80

Calls 2

ensureWriteableSpaceMethod · 0.80
setMethod · 0.80

Tested by

no test coverage detected