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

Method decode

javascript/packages/core/lib/meta/MetaString.ts:95–113  ·  view source on GitHub ↗
(reader: BinaryReader, len: number, encoding: Encoding)

Source from the content-addressed store, hash-verified

93 }
94
95 public decode(reader: BinaryReader, len: number, encoding: Encoding): string {
96 if (!len) {
97 return "";
98 }
99 switch (encoding) {
100 case Encoding.LOWER_SPECIAL:
101 return this.decodeLowerSpecial(reader.bufferRef(len));
102 case Encoding.LOWER_UPPER_DIGIT_SPECIAL:
103 return this.decodeLowerUpperDigitSpecial(reader.bufferRef(len));
104 case Encoding.FIRST_TO_LOWER_SPECIAL:
105 return this.decodeRepFirstLowerSpecial(reader.bufferRef(len));
106 case Encoding.ALL_TO_LOWER_SPECIAL:
107 return this.decodeRepAllToLowerSpecial(reader.bufferRef(len));
108 case Encoding.UTF_8:
109 return reader.stringUtf8(len);
110 default:
111 throw new Error("Unexpected encoding flag: " + encoding);
112 }
113 }
114
115 /** Decoding method for {@link Encoding#LOWER_SPECIAL}. */
116 private decodeLowerSpecial(data: Uint8Array) {

Callers

nothing calls this directly

Calls 6

decodeLowerSpecialMethod · 0.95
bufferRefMethod · 0.45
stringUtf8Method · 0.45

Tested by

no test coverage detected