MCPcopy Create free account
hub / github.com/apache/fory / writeHead

Method writeHead

javascript/packages/core/lib/gen/map.ts:97–115  ·  view source on GitHub ↗
(
    keyInfo: ElementInfo,
    valueInfo: ElementInfo,
    withOutSize = false,
  )

Source from the content-addressed store, hash-verified

95 }
96
97 private writeHead(
98 keyInfo: ElementInfo,
99 valueInfo: ElementInfo,
100 withOutSize = false,
101 ) {
102 // KV header
103 const header = this.getHead(keyInfo, valueInfo);
104 // chunkSize default 0 | KV header
105 this.writeContext.writer.writeUint8(header);
106
107 if (!withOutSize) {
108 // chunkSize, max 255
109 this.chunkOffset = this.writeContext.writer.writeGetCursor();
110 this.writeContext.writer.writeUint8(0);
111 } else {
112 this.chunkOffset = 0;
113 }
114 return header;
115 }
116
117 public isFirst() {
118 return this.chunkSize === 0 || this.chunkSize === 1;

Callers 1

nextMethod · 0.95

Calls 3

getHeadMethod · 0.95
writeUint8Method · 0.45
writeGetCursorMethod · 0.45

Tested by

no test coverage detected