@cloudpss/ubjson 0.4.11 → 0.4.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (56) hide show
  1. package/benchmark-string.js +32 -32
  2. package/benchmark.js +33 -35
  3. package/dist/common/constants.d.ts +21 -21
  4. package/dist/common/constants.js +21 -21
  5. package/dist/common/decoder.d.ts +52 -52
  6. package/dist/common/decoder.js +277 -277
  7. package/dist/common/encoder.d.ts +74 -74
  8. package/dist/common/encoder.js +282 -282
  9. package/dist/common/string-decoder.d.ts +13 -13
  10. package/dist/common/string-decoder.js +106 -106
  11. package/dist/common/string-encoder.d.ts +6 -6
  12. package/dist/common/string-encoder.js +37 -37
  13. package/dist/decoder.d.ts +2 -2
  14. package/dist/decoder.js +2 -2
  15. package/dist/encoder.d.ts +11 -11
  16. package/dist/encoder.js +77 -77
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +15 -15
  19. package/dist/rxjs/decoder.d.ts +3 -3
  20. package/dist/rxjs/decoder.js +69 -69
  21. package/dist/rxjs/decoder.js.map +1 -1
  22. package/dist/rxjs/encoder.d.ts +3 -3
  23. package/dist/rxjs/encoder.js +27 -27
  24. package/dist/rxjs/encoder.js.map +1 -1
  25. package/dist/rxjs/index.d.ts +2 -2
  26. package/dist/rxjs/index.js +2 -2
  27. package/dist/stream/decoder.d.ts +13 -13
  28. package/dist/stream/decoder.js +51 -51
  29. package/dist/stream/decoder.js.map +1 -1
  30. package/dist/stream/encoder.d.ts +9 -9
  31. package/dist/stream/encoder.js +22 -22
  32. package/dist/stream/encoder.js.map +1 -1
  33. package/dist/stream/index.d.ts +11 -11
  34. package/dist/stream/index.js +31 -31
  35. package/dist/stream/index.js.map +1 -1
  36. package/dist/stream-helper/decoder.d.ts +8 -8
  37. package/dist/stream-helper/decoder.js +12 -12
  38. package/dist/stream-helper/encoder.d.ts +12 -12
  39. package/dist/stream-helper/encoder.js +56 -56
  40. package/dist/utils.d.ts +2 -2
  41. package/dist/utils.js +7 -7
  42. package/package.json +3 -2
  43. package/src/rxjs/decoder.ts +1 -1
  44. package/src/rxjs/encoder.ts +1 -1
  45. package/src/stream/decoder.ts +1 -1
  46. package/src/stream/encoder.ts +1 -1
  47. package/tests/.utils.js +25 -0
  48. package/tests/decode.js +2 -9
  49. package/tests/e2e.js +2 -0
  50. package/tests/encode.js +13 -17
  51. package/tests/rxjs/decode.js +8 -11
  52. package/tests/rxjs/encode.js +17 -19
  53. package/tests/stream/decode.js +7 -10
  54. package/tests/stream/encode.js +16 -18
  55. package/tests/string-encoding.js +7 -14
  56. package/yarn-error.log +4520 -0
@@ -1,283 +1,283 @@
1
- /* eslint-disable @typescript-eslint/unbound-method */
2
- import * as constants from './constants.js';
3
- import { StringEncoder } from './string-encoder.js';
4
- /** 编码至 ubjson */
5
- export class EncoderBase {
6
- constructor(value) {
7
- this.value = value;
8
- /** 字符串编码 */
9
- this.stringEncoder = new StringEncoder();
10
- /** 当前写指针位置 */
11
- this.length = 0;
12
- }
13
- /** 写入一个对象 */
14
- write(value) {
15
- switch (typeof value) {
16
- case 'undefined':
17
- return this.writeNoOp();
18
- case 'boolean':
19
- return this.writeBoolean(value);
20
- case 'number':
21
- return this.writeNumber(value);
22
- case 'string':
23
- if (value.length === 1 && value.charCodeAt(0) < 255) {
24
- // 1 byte string
25
- return this.writeChar(value);
26
- }
27
- return this.writeString(value);
28
- case 'object': {
29
- if (value === null) {
30
- return this.writeNull();
31
- }
32
- if (Array.isArray(value)) {
33
- return this.writeArray(value);
34
- }
35
- if (ArrayBuffer.isView(value)) {
36
- return this.writeTypedArray(value);
37
- }
38
- return this.writeObject(value);
39
- }
40
- default:
41
- throw new Error(`Unsupported type ${Object.prototype.toString.call(value)}`);
42
- }
43
- }
44
- /** 写入 marker */
45
- writeMarker(marker) {
46
- this.ensureCapacity(1);
47
- this.view.setUint8(this.length, marker);
48
- this.length += 1;
49
- }
50
- /** 写入 marker */
51
- writeNull() {
52
- this.writeMarker(constants.NULL);
53
- }
54
- /** writeNoOp */
55
- writeNoOp() {
56
- this.writeMarker(constants.NO_OP);
57
- }
58
- /** writeBoolean */
59
- writeBoolean(value) {
60
- this.writeMarker(value ? constants.TRUE : constants.FALSE);
61
- }
62
- /** writeInt8 */
63
- writeInt8(value) {
64
- this.writeMarker(constants.INT8);
65
- this.writeInt8Data(value);
66
- }
67
- /** writeInt8Data */
68
- writeInt8Data(value) {
69
- this.ensureCapacity(1);
70
- this.view.setInt8(this.length, value);
71
- this.length += 1;
72
- }
73
- /** writeUint8 */
74
- writeUint8(value) {
75
- this.writeMarker(constants.UINT8);
76
- this.writeUint8Data(value);
77
- }
78
- /** writeUint8Data */
79
- writeUint8Data(value) {
80
- this.ensureCapacity(1);
81
- this.view.setUint8(this.length, value);
82
- this.length += 1;
83
- }
84
- /** writeInt16 */
85
- writeInt16(value) {
86
- this.writeMarker(constants.INT16);
87
- this.writeInt16Data(value);
88
- }
89
- /** writeInt16Data */
90
- writeInt16Data(value) {
91
- this.ensureCapacity(2);
92
- this.view.setInt16(this.length, value);
93
- this.length += 2;
94
- }
95
- /** writeInt32 */
96
- writeInt32(value) {
97
- this.writeMarker(constants.INT32);
98
- this.writeInt32Data(value);
99
- }
100
- /** writeInt32Data */
101
- writeInt32Data(value) {
102
- this.ensureCapacity(4);
103
- this.view.setInt32(this.length, value);
104
- this.length += 4;
105
- }
106
- /** writeFloat32 */
107
- writeFloat32(value) {
108
- this.writeMarker(constants.FLOAT32);
109
- this.writeFloat32Data(value);
110
- }
111
- /** writeFloat32Data */
112
- writeFloat32Data(value) {
113
- this.ensureCapacity(4);
114
- this.view.setFloat32(this.length, value);
115
- this.length += 4;
116
- }
117
- /** writeFloat64 */
118
- writeFloat64(value) {
119
- this.writeMarker(constants.FLOAT64);
120
- this.writeFloat64Data(value);
121
- }
122
- /** writeFloat64Data */
123
- writeFloat64Data(value) {
124
- this.ensureCapacity(8);
125
- this.view.setFloat64(this.length, value);
126
- this.length += 8;
127
- }
128
- /** writeChar */
129
- writeChar(value) {
130
- this.writeMarker(constants.CHAR);
131
- this.writeCharData(value);
132
- }
133
- /** writeCharData */
134
- writeCharData(value) {
135
- this.ensureCapacity(1);
136
- this.view.setUint8(this.length, value.charCodeAt(0));
137
- this.length += 1;
138
- }
139
- /** writeString */
140
- writeString(value) {
141
- this.writeMarker(constants.STRING);
142
- this.writeStringData(value);
143
- }
144
- /** writeStringData */
145
- writeStringData(value) {
146
- // 优化小字符串
147
- if (value.length < 32) {
148
- const buf = this.stringEncoder.encode(value);
149
- this.writeInt(buf.length);
150
- this.ensureCapacity(buf.length);
151
- this.buffer.set(buf, this.length);
152
- this.length += buf.length;
153
- return;
154
- }
155
- if (this.stringEncoder.encodeInto != null) {
156
- const maxUsage = value.length * 3;
157
- // 一次性分配 writeInt 和 encodeInto 的空间,避免无法回溯
158
- this.ensureCapacity(maxUsage + 4);
159
- const currentPos = this.length;
160
- // 先写入最大大小
161
- const lengthWriter = this.writeInt(maxUsage);
162
- // 写入文本数据
163
- const { written } = this.stringEncoder.encodeInto(value, this.buffer.subarray(this.length));
164
- // 回溯,写入实际大小
165
- this.length = currentPos;
166
- lengthWriter.call(this, written);
167
- // 移动指针到写入末尾
168
- this.length += written;
169
- return;
170
- }
171
- const data = this.stringEncoder.encode(value);
172
- this.writeInt(data.length);
173
- this.ensureCapacity(data.length);
174
- this.buffer.set(data, this.length);
175
- this.length += data.length;
176
- }
177
- /**
178
- * 写入整形数字,选取合适的大小
179
- *
180
- * @throws 无法在 int32 范围内表示
181
- */
182
- writeInt(value) {
183
- value = value | 0;
184
- if (value >= -128 && value <= 127) {
185
- this.writeInt8(value);
186
- return this.writeInt8;
187
- }
188
- if (value >= -32768 && value <= 32767) {
189
- this.writeInt16(value);
190
- return this.writeInt16;
191
- }
192
- if (value >= -2147483648 && value <= 2147483647) {
193
- this.writeInt32(value);
194
- return this.writeInt32;
195
- }
196
- /* c8 ignore next 2 */
197
- throw new Error(`Unsupported int value ${value}: out of range`);
198
- }
199
- /** 写入数字,选取合适的大小 */
200
- writeNumber(value) {
201
- if (Number.isInteger(value) && value >= -2147483648 && value <= 2147483647) {
202
- if (value >= 0 && value <= 255)
203
- return this.writeUint8(value);
204
- this.writeInt(value);
205
- return;
206
- }
207
- if (!(Number.isNaN(value) || Math.fround(value) === value)) {
208
- return this.writeFloat64(value);
209
- }
210
- // 如果不会损失精度,则使用 32 位浮点
211
- return this.writeFloat32(value);
212
- }
213
- /** writeObject */
214
- writeObject(value) {
215
- this.writeMarker(constants.OBJECT);
216
- // 生成稳定的结果以便 hash 计算
217
- for (const key of Object.keys(value).sort()) {
218
- const element = value[key];
219
- if (element === undefined)
220
- continue;
221
- this.writeStringData(key);
222
- this.write(element);
223
- }
224
- this.writeMarker(constants.OBJECT_END);
225
- }
226
- /** writeArray */
227
- writeArray(value) {
228
- this.writeMarker(constants.ARRAY);
229
- for (const v of value) {
230
- // 在数组中 undefined 也被视作 null 进行序列化
231
- if (v == null)
232
- this.writeNull();
233
- else
234
- this.write(v);
235
- }
236
- this.writeMarker(constants.ARRAY_END);
237
- }
238
- /** writeArray */
239
- writeTypedArray(value) {
240
- this.writeMarker(constants.ARRAY);
241
- this.writeMarker(constants.TYPE_MARKER);
242
- if (value instanceof Uint8Array || value instanceof Int8Array) {
243
- // fast path for typed arrays with `BYTES_PER_ELEMENT` of 1
244
- this.writeMarker(value instanceof Uint8Array ? constants.UINT8 : constants.INT8);
245
- this.writeMarker(constants.COUNT_MARKER);
246
- this.writeInt(value.length);
247
- this.ensureCapacity(value.byteLength);
248
- this.buffer.set(value, this.length);
249
- this.length += value.byteLength;
250
- return;
251
- }
252
- /** 用于写入的 setter */
253
- let setValue;
254
- if (value instanceof Int16Array) {
255
- this.writeMarker(constants.INT16);
256
- setValue = this.view.setInt16;
257
- }
258
- else if (value instanceof Int32Array) {
259
- this.writeMarker(constants.INT32);
260
- setValue = this.view.setInt32;
261
- }
262
- else if (value instanceof Float32Array) {
263
- this.writeMarker(constants.FLOAT32);
264
- setValue = this.view.setFloat32;
265
- }
266
- else if (value instanceof Float64Array) {
267
- this.writeMarker(constants.FLOAT64);
268
- setValue = this.view.setFloat64;
269
- }
270
- else {
271
- throw new Error(`Unsupported typed array type ${Object.prototype.toString.call(value)}`);
272
- }
273
- this.writeMarker(constants.COUNT_MARKER);
274
- this.writeInt(value.length);
275
- this.ensureCapacity(value.byteLength);
276
- // 不要在前面 bind,this.ensureCapacity 有可能导致 this.view 指向新的对象
277
- for (const v of value) {
278
- setValue.call(this.view, this.length, v);
279
- this.length += value.BYTES_PER_ELEMENT;
280
- }
281
- }
282
- }
1
+ /* eslint-disable @typescript-eslint/unbound-method */
2
+ import * as constants from './constants.js';
3
+ import { StringEncoder } from './string-encoder.js';
4
+ /** 编码至 ubjson */
5
+ export class EncoderBase {
6
+ constructor(value) {
7
+ this.value = value;
8
+ /** 字符串编码 */
9
+ this.stringEncoder = new StringEncoder();
10
+ /** 当前写指针位置 */
11
+ this.length = 0;
12
+ }
13
+ /** 写入一个对象 */
14
+ write(value) {
15
+ switch (typeof value) {
16
+ case 'undefined':
17
+ return this.writeNoOp();
18
+ case 'boolean':
19
+ return this.writeBoolean(value);
20
+ case 'number':
21
+ return this.writeNumber(value);
22
+ case 'string':
23
+ if (value.length === 1 && value.charCodeAt(0) < 255) {
24
+ // 1 byte string
25
+ return this.writeChar(value);
26
+ }
27
+ return this.writeString(value);
28
+ case 'object': {
29
+ if (value === null) {
30
+ return this.writeNull();
31
+ }
32
+ if (Array.isArray(value)) {
33
+ return this.writeArray(value);
34
+ }
35
+ if (ArrayBuffer.isView(value)) {
36
+ return this.writeTypedArray(value);
37
+ }
38
+ return this.writeObject(value);
39
+ }
40
+ default:
41
+ throw new Error(`Unsupported type ${Object.prototype.toString.call(value)}`);
42
+ }
43
+ }
44
+ /** 写入 marker */
45
+ writeMarker(marker) {
46
+ this.ensureCapacity(1);
47
+ this.view.setUint8(this.length, marker);
48
+ this.length += 1;
49
+ }
50
+ /** 写入 marker */
51
+ writeNull() {
52
+ this.writeMarker(constants.NULL);
53
+ }
54
+ /** writeNoOp */
55
+ writeNoOp() {
56
+ this.writeMarker(constants.NO_OP);
57
+ }
58
+ /** writeBoolean */
59
+ writeBoolean(value) {
60
+ this.writeMarker(value ? constants.TRUE : constants.FALSE);
61
+ }
62
+ /** writeInt8 */
63
+ writeInt8(value) {
64
+ this.writeMarker(constants.INT8);
65
+ this.writeInt8Data(value);
66
+ }
67
+ /** writeInt8Data */
68
+ writeInt8Data(value) {
69
+ this.ensureCapacity(1);
70
+ this.view.setInt8(this.length, value);
71
+ this.length += 1;
72
+ }
73
+ /** writeUint8 */
74
+ writeUint8(value) {
75
+ this.writeMarker(constants.UINT8);
76
+ this.writeUint8Data(value);
77
+ }
78
+ /** writeUint8Data */
79
+ writeUint8Data(value) {
80
+ this.ensureCapacity(1);
81
+ this.view.setUint8(this.length, value);
82
+ this.length += 1;
83
+ }
84
+ /** writeInt16 */
85
+ writeInt16(value) {
86
+ this.writeMarker(constants.INT16);
87
+ this.writeInt16Data(value);
88
+ }
89
+ /** writeInt16Data */
90
+ writeInt16Data(value) {
91
+ this.ensureCapacity(2);
92
+ this.view.setInt16(this.length, value);
93
+ this.length += 2;
94
+ }
95
+ /** writeInt32 */
96
+ writeInt32(value) {
97
+ this.writeMarker(constants.INT32);
98
+ this.writeInt32Data(value);
99
+ }
100
+ /** writeInt32Data */
101
+ writeInt32Data(value) {
102
+ this.ensureCapacity(4);
103
+ this.view.setInt32(this.length, value);
104
+ this.length += 4;
105
+ }
106
+ /** writeFloat32 */
107
+ writeFloat32(value) {
108
+ this.writeMarker(constants.FLOAT32);
109
+ this.writeFloat32Data(value);
110
+ }
111
+ /** writeFloat32Data */
112
+ writeFloat32Data(value) {
113
+ this.ensureCapacity(4);
114
+ this.view.setFloat32(this.length, value);
115
+ this.length += 4;
116
+ }
117
+ /** writeFloat64 */
118
+ writeFloat64(value) {
119
+ this.writeMarker(constants.FLOAT64);
120
+ this.writeFloat64Data(value);
121
+ }
122
+ /** writeFloat64Data */
123
+ writeFloat64Data(value) {
124
+ this.ensureCapacity(8);
125
+ this.view.setFloat64(this.length, value);
126
+ this.length += 8;
127
+ }
128
+ /** writeChar */
129
+ writeChar(value) {
130
+ this.writeMarker(constants.CHAR);
131
+ this.writeCharData(value);
132
+ }
133
+ /** writeCharData */
134
+ writeCharData(value) {
135
+ this.ensureCapacity(1);
136
+ this.view.setUint8(this.length, value.charCodeAt(0));
137
+ this.length += 1;
138
+ }
139
+ /** writeString */
140
+ writeString(value) {
141
+ this.writeMarker(constants.STRING);
142
+ this.writeStringData(value);
143
+ }
144
+ /** writeStringData */
145
+ writeStringData(value) {
146
+ // 优化小字符串
147
+ if (value.length < 32) {
148
+ const buf = this.stringEncoder.encode(value);
149
+ this.writeInt(buf.length);
150
+ this.ensureCapacity(buf.length);
151
+ this.buffer.set(buf, this.length);
152
+ this.length += buf.length;
153
+ return;
154
+ }
155
+ if (this.stringEncoder.encodeInto != null) {
156
+ const maxUsage = value.length * 3;
157
+ // 一次性分配 writeInt 和 encodeInto 的空间,避免无法回溯
158
+ this.ensureCapacity(maxUsage + 4);
159
+ const currentPos = this.length;
160
+ // 先写入最大大小
161
+ const lengthWriter = this.writeInt(maxUsage);
162
+ // 写入文本数据
163
+ const { written } = this.stringEncoder.encodeInto(value, this.buffer.subarray(this.length));
164
+ // 回溯,写入实际大小
165
+ this.length = currentPos;
166
+ lengthWriter.call(this, written);
167
+ // 移动指针到写入末尾
168
+ this.length += written;
169
+ return;
170
+ }
171
+ const data = this.stringEncoder.encode(value);
172
+ this.writeInt(data.length);
173
+ this.ensureCapacity(data.length);
174
+ this.buffer.set(data, this.length);
175
+ this.length += data.length;
176
+ }
177
+ /**
178
+ * 写入整形数字,选取合适的大小
179
+ *
180
+ * @throws 无法在 int32 范围内表示
181
+ */
182
+ writeInt(value) {
183
+ value = value | 0;
184
+ if (value >= -128 && value <= 127) {
185
+ this.writeInt8(value);
186
+ return this.writeInt8;
187
+ }
188
+ if (value >= -32768 && value <= 32767) {
189
+ this.writeInt16(value);
190
+ return this.writeInt16;
191
+ }
192
+ if (value >= -2147483648 && value <= 2147483647) {
193
+ this.writeInt32(value);
194
+ return this.writeInt32;
195
+ }
196
+ /* c8 ignore next 2 */
197
+ throw new Error(`Unsupported int value ${value}: out of range`);
198
+ }
199
+ /** 写入数字,选取合适的大小 */
200
+ writeNumber(value) {
201
+ if (Number.isInteger(value) && value >= -2147483648 && value <= 2147483647) {
202
+ if (value >= 0 && value <= 255)
203
+ return this.writeUint8(value);
204
+ this.writeInt(value);
205
+ return;
206
+ }
207
+ if (!(Number.isNaN(value) || Math.fround(value) === value)) {
208
+ return this.writeFloat64(value);
209
+ }
210
+ // 如果不会损失精度,则使用 32 位浮点
211
+ return this.writeFloat32(value);
212
+ }
213
+ /** writeObject */
214
+ writeObject(value) {
215
+ this.writeMarker(constants.OBJECT);
216
+ // 生成稳定的结果以便 hash 计算
217
+ for (const key of Object.keys(value).sort()) {
218
+ const element = value[key];
219
+ if (element === undefined)
220
+ continue;
221
+ this.writeStringData(key);
222
+ this.write(element);
223
+ }
224
+ this.writeMarker(constants.OBJECT_END);
225
+ }
226
+ /** writeArray */
227
+ writeArray(value) {
228
+ this.writeMarker(constants.ARRAY);
229
+ for (const v of value) {
230
+ // 在数组中 undefined 也被视作 null 进行序列化
231
+ if (v == null)
232
+ this.writeNull();
233
+ else
234
+ this.write(v);
235
+ }
236
+ this.writeMarker(constants.ARRAY_END);
237
+ }
238
+ /** writeArray */
239
+ writeTypedArray(value) {
240
+ this.writeMarker(constants.ARRAY);
241
+ this.writeMarker(constants.TYPE_MARKER);
242
+ if (value instanceof Uint8Array || value instanceof Int8Array) {
243
+ // fast path for typed arrays with `BYTES_PER_ELEMENT` of 1
244
+ this.writeMarker(value instanceof Uint8Array ? constants.UINT8 : constants.INT8);
245
+ this.writeMarker(constants.COUNT_MARKER);
246
+ this.writeInt(value.length);
247
+ this.ensureCapacity(value.byteLength);
248
+ this.buffer.set(value, this.length);
249
+ this.length += value.byteLength;
250
+ return;
251
+ }
252
+ /** 用于写入的 setter */
253
+ let setValue;
254
+ if (value instanceof Int16Array) {
255
+ this.writeMarker(constants.INT16);
256
+ setValue = this.view.setInt16;
257
+ }
258
+ else if (value instanceof Int32Array) {
259
+ this.writeMarker(constants.INT32);
260
+ setValue = this.view.setInt32;
261
+ }
262
+ else if (value instanceof Float32Array) {
263
+ this.writeMarker(constants.FLOAT32);
264
+ setValue = this.view.setFloat32;
265
+ }
266
+ else if (value instanceof Float64Array) {
267
+ this.writeMarker(constants.FLOAT64);
268
+ setValue = this.view.setFloat64;
269
+ }
270
+ else {
271
+ throw new Error(`Unsupported typed array type ${Object.prototype.toString.call(value)}`);
272
+ }
273
+ this.writeMarker(constants.COUNT_MARKER);
274
+ this.writeInt(value.length);
275
+ this.ensureCapacity(value.byteLength);
276
+ // 不要在前面 bind,this.ensureCapacity 有可能导致 this.view 指向新的对象
277
+ for (const v of value) {
278
+ setValue.call(this.view, this.length, v);
279
+ this.length += value.BYTES_PER_ELEMENT;
280
+ }
281
+ }
282
+ }
283
283
  //# sourceMappingURL=encoder.js.map
@@ -1,13 +1,13 @@
1
- export declare const textDecoder: TextDecoder | null;
2
- export declare const TEXT_ENCODER_THRESHOLD: number;
3
- /** 解码 */
4
- export declare function decodeJs(bytes: Uint8Array, begin: number, end: number): string;
5
- /** 解码 */
6
- export declare function decode(data: Uint8Array, begin: number, end: number): string;
7
- /** 特别优化字符串解码速度 */
8
- export declare class StringDecoder {
9
- /** 小字符串缓存 */
10
- private readonly cache;
11
- /** 字符串解码 */
12
- decode(data: Uint8Array, begin: number, end: number): string;
13
- }
1
+ export declare const textDecoder: TextDecoder | null;
2
+ export declare const TEXT_ENCODER_THRESHOLD: number;
3
+ /** 解码 */
4
+ export declare function decodeJs(bytes: Uint8Array, begin: number, end: number): string;
5
+ /** 解码 */
6
+ export declare function decode(data: Uint8Array, begin: number, end: number): string;
7
+ /** 特别优化字符串解码速度 */
8
+ export declare class StringDecoder {
9
+ /** 小字符串缓存 */
10
+ private readonly cache;
11
+ /** 字符串解码 */
12
+ decode(data: Uint8Array, begin: number, end: number): string;
13
+ }