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

Method writeBytes

javascript/packages/core/lib/context.ts:268–282  ·  view source on GitHub ↗
(writer: BinaryWriter, bytes: MetaStringBytes)

Source from the content-addressed store, hash-verified

266 private typenameEncoder = new MetaStringEncoder("$", "_");
267
268 writeBytes(writer: BinaryWriter, bytes: MetaStringBytes) {
269 if (bytes.dynamicWriteStringId !== -1) {
270 writer.writeVarUInt32(((this.dynamicNameId + 1) << 1) | 1);
271 } else {
272 bytes.dynamicWriteStringId = this.dynamicNameId;
273 this.dynamicNameId += 1;
274 this.disposeMetaStringBytes.push(bytes);
275 const len = bytes.bytes.getBytes().byteLength;
276 writer.writeVarUInt32(len << 1);
277 if (len !== 0) {
278 writer.writeUint8(bytes.bytes.getEncoding());
279 }
280 writer.buffer(bytes.bytes.getBytes());
281 }
282 }
283
284 encodeNamespace(input: string) {
285 return new MetaStringBytes(this.namespaceEncoder.encode(input));

Callers 9

roundTripFileFunction · 0.45
denseArrayRoundTripFunction · 0.45
writeMetaStringBytesMethod · 0.45
bytesCopyAlignedMethod · 0.45
bytesCopyUnalignedMethod · 0.45

Calls 5

writeVarUInt32Method · 0.45
getBytesMethod · 0.45
writeUint8Method · 0.45
getEncodingMethod · 0.45
bufferMethod · 0.45

Tested by

no test coverage detected