MCPcopy Index your code
hub / github.com/ColmapView/Colmapview.github.io / ensureCapacity

Method ensureCapacity

src/parsers/BinaryWriter.ts:23–32  ·  view source on GitHub ↗

* Ensure there's enough space in the current chunk for the next write. * If not, save the current chunk and allocate a new one.

(bytes: number)

Source from the content-addressed store, hash-verified

21 * If not, save the current chunk and allocate a new one.
22 */
23 private ensureCapacity(bytes: number): void {
24 if (this.offset + bytes > this.chunkSize) {
25 // Save current chunk (trimmed to actual size used)
26 this.chunks.push(this.currentBuffer.slice(0, this.offset));
27 // Allocate new chunk
28 this.currentBuffer = new ArrayBuffer(this.chunkSize);
29 this.currentView = new DataView(this.currentBuffer);
30 this.offset = 0;
31 }
32 }
33
34 writeUint8(value: number): void {
35 this.ensureCapacity(1);

Callers 6

writeUint8Method · 0.95
writeUint32Method · 0.95
writeInt32Method · 0.95
writeUint64Method · 0.95
writeInt64Method · 0.95
writeFloat64Method · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected