MCPcopy Create free account
hub / github.com/Tencent/libpag / readUTF8String

Method readUTF8String

web/lite/src/codec/utils/byte-array.ts:155–169  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

153 }
154
155 public readUTF8String(): string {
156 if (this._position >= this.length) throw new Error(ErrorMessage.PAGDecodeError);
157 let encoded = '';
158 let dataLength = 0;
159 for (let i = this._position; i < this.length; i++) {
160 if (this.dataView.getUint8(i) === 0) {
161 break;
162 }
163 encoded += `%${this.dataView.getUint8(i).toString(16)}`;
164 dataLength += 1;
165 }
166 this._position += dataLength;
167 this.positonChanged();
168 return decodeURIComponent(encoded);
169 }
170
171 public readEncodedUint32(): number {
172 const valueMask = 127;

Callers 2

readStringFunction · 0.45
readValueMethod · 0.45

Calls 2

positonChangedMethod · 0.95
toStringMethod · 0.80

Tested by

no test coverage detected