binary-structures-values 0.1.0
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.
- package/dist/cjs/bit-stream-reader.d.ts +33 -0
- package/dist/cjs/bit-stream-reader.js +340 -0
- package/dist/cjs/bit-stream-writer.d.ts +36 -0
- package/dist/cjs/bit-stream-writer.js +336 -0
- package/dist/cjs/compiler-old.d.ts +9 -0
- package/dist/cjs/compiler-old.js +268 -0
- package/dist/cjs/data-stream-reader.d.ts +23 -0
- package/dist/cjs/data-stream-reader.js +132 -0
- package/dist/cjs/data-stream-writer.d.ts +22 -0
- package/dist/cjs/data-stream-writer.js +179 -0
- package/dist/cjs/index.d.ts +5 -0
- package/dist/cjs/index.js +21 -0
- package/dist/cjs/schema-structure.d.ts +54 -0
- package/dist/cjs/schema-structure.js +273 -0
- package/dist/esm/bit-stream-reader.d.ts +33 -0
- package/dist/esm/bit-stream-reader.js +336 -0
- package/dist/esm/bit-stream-writer.d.ts +36 -0
- package/dist/esm/bit-stream-writer.js +335 -0
- package/dist/esm/compiler-old.d.ts +9 -0
- package/dist/esm/compiler-old.js +264 -0
- package/dist/esm/data-stream-reader.d.ts +23 -0
- package/dist/esm/data-stream-reader.js +128 -0
- package/dist/esm/data-stream-writer.d.ts +22 -0
- package/dist/esm/data-stream-writer.js +175 -0
- package/dist/esm/index.d.ts +5 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/schema-structure.d.ts +54 -0
- package/dist/esm/schema-structure.js +267 -0
- package/package.json +38 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export declare class BitStreamReader {
|
|
2
|
+
private byteArray;
|
|
3
|
+
protected bitPosition: number;
|
|
4
|
+
private currentDataSize;
|
|
5
|
+
private totalAvailableBits;
|
|
6
|
+
private isComplete;
|
|
7
|
+
private _shared_array_buffer;
|
|
8
|
+
private _shared_float_64_array;
|
|
9
|
+
private _shared_float_32_array;
|
|
10
|
+
private _shared_uint8_array;
|
|
11
|
+
private _shared_data_view;
|
|
12
|
+
constructor(initialData?: Uint8Array | Buffer<ArrayBuffer>, isComplete?: boolean);
|
|
13
|
+
private resizeIfNeeded;
|
|
14
|
+
markComplete(): void;
|
|
15
|
+
private recalculateTotalBits;
|
|
16
|
+
reset(): void;
|
|
17
|
+
addData(data: Uint8Array): void;
|
|
18
|
+
readBit(): boolean;
|
|
19
|
+
readBits(count: number): boolean[];
|
|
20
|
+
readByte(): number;
|
|
21
|
+
private readInt;
|
|
22
|
+
readInt8(): number;
|
|
23
|
+
readInt16(): number;
|
|
24
|
+
readInt32(): number;
|
|
25
|
+
readBigInt(): bigint;
|
|
26
|
+
readFloat32(): number;
|
|
27
|
+
readFloat64(): number;
|
|
28
|
+
readString(): string;
|
|
29
|
+
canReadBits(size: number, throwIfNotEnough?: boolean): boolean;
|
|
30
|
+
canReadString(throwIfNotEnough?: boolean): boolean;
|
|
31
|
+
getAvailableBits(): number;
|
|
32
|
+
isDataComplete(): boolean;
|
|
33
|
+
}
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BitStreamReader = void 0;
|
|
4
|
+
class BitStreamReader {
|
|
5
|
+
constructor(initialData, isComplete = false) {
|
|
6
|
+
this.bitPosition = 0;
|
|
7
|
+
this.currentDataSize = 0;
|
|
8
|
+
this.totalAvailableBits = 0;
|
|
9
|
+
this.isComplete = false;
|
|
10
|
+
this._shared_array_buffer = new ArrayBuffer(8);
|
|
11
|
+
this._shared_float_64_array = new Float64Array(this._shared_array_buffer);
|
|
12
|
+
this._shared_float_32_array = new Float32Array(this._shared_array_buffer);
|
|
13
|
+
this._shared_uint8_array = new Uint8Array(this._shared_array_buffer);
|
|
14
|
+
this._shared_data_view = new DataView(this._shared_array_buffer);
|
|
15
|
+
this.byteArray = new Uint8Array(0);
|
|
16
|
+
this.isComplete = isComplete;
|
|
17
|
+
if (initialData)
|
|
18
|
+
this.addData(initialData);
|
|
19
|
+
}
|
|
20
|
+
resizeIfNeeded(needed) {
|
|
21
|
+
if (this.currentDataSize + needed > this.byteArray.length) {
|
|
22
|
+
const newLength = Math.max(this.byteArray.length << 1, this.currentDataSize + needed);
|
|
23
|
+
const newArray = new Uint8Array(newLength);
|
|
24
|
+
newArray.set(this.byteArray.subarray(0, this.currentDataSize));
|
|
25
|
+
this.byteArray = newArray;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
markComplete() {
|
|
29
|
+
this.isComplete = true;
|
|
30
|
+
this.recalculateTotalBits();
|
|
31
|
+
}
|
|
32
|
+
recalculateTotalBits() {
|
|
33
|
+
if (this.currentDataSize === 0) {
|
|
34
|
+
this.totalAvailableBits = 0;
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
if (this.isComplete) {
|
|
38
|
+
const paddingByte = this.byteArray[this.currentDataSize - 1];
|
|
39
|
+
this.totalAvailableBits = ((this.currentDataSize - 1) << 3) - paddingByte;
|
|
40
|
+
}
|
|
41
|
+
else {
|
|
42
|
+
const safeBytesCount = Math.max(0, this.currentDataSize - 2);
|
|
43
|
+
this.totalAvailableBits = safeBytesCount << 3;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
reset() {
|
|
47
|
+
this.bitPosition = 0;
|
|
48
|
+
}
|
|
49
|
+
addData(data) {
|
|
50
|
+
this.resizeIfNeeded(data.length);
|
|
51
|
+
this.byteArray.set(data, this.currentDataSize);
|
|
52
|
+
this.currentDataSize += data.length;
|
|
53
|
+
this.recalculateTotalBits();
|
|
54
|
+
}
|
|
55
|
+
readBit() {
|
|
56
|
+
if (!this.isComplete) {
|
|
57
|
+
if (this.bitPosition >= this.totalAvailableBits) {
|
|
58
|
+
throw new Error(`Cannot read 1 bits at position ${this.bitPosition}, not enough bits available`);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
const byteIndex = this.bitPosition >>> 3;
|
|
62
|
+
const bitIndex = 7 - (this.bitPosition & 7);
|
|
63
|
+
const bit = (this.byteArray[byteIndex] >> bitIndex) & 1;
|
|
64
|
+
this.bitPosition++;
|
|
65
|
+
return bit === 1;
|
|
66
|
+
}
|
|
67
|
+
readBits(count) {
|
|
68
|
+
if (!this.isComplete) {
|
|
69
|
+
if (this.bitPosition + count > this.totalAvailableBits) {
|
|
70
|
+
throw new Error(`Cannot read ${count} bits at position ${this.bitPosition}, not enough bits available`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
const bits = new Array(count);
|
|
74
|
+
const data = this.byteArray;
|
|
75
|
+
let pos = this.bitPosition;
|
|
76
|
+
for (let i = 0; i < count; i++) {
|
|
77
|
+
const byteIndex = pos >>> 3;
|
|
78
|
+
const bitIndex = 7 - (pos & 7);
|
|
79
|
+
bits[i] = ((data[byteIndex] >> bitIndex) & 1) === 1;
|
|
80
|
+
pos++;
|
|
81
|
+
}
|
|
82
|
+
this.bitPosition = pos;
|
|
83
|
+
return bits;
|
|
84
|
+
}
|
|
85
|
+
readByte() {
|
|
86
|
+
if (!this.isComplete) {
|
|
87
|
+
if (this.bitPosition + 8 > this.totalAvailableBits) {
|
|
88
|
+
throw new Error(`Cannot read 8 bits at position ${this.bitPosition}, not enough bits available`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const data = this.byteArray;
|
|
92
|
+
let pos = this.bitPosition;
|
|
93
|
+
let value = 0;
|
|
94
|
+
for (let i = 7; i >= 0; i--) {
|
|
95
|
+
const byteIndex = pos >>> 3;
|
|
96
|
+
const bitIndex = 7 - (pos & 7);
|
|
97
|
+
const bit = (data[byteIndex] >> bitIndex) & 1;
|
|
98
|
+
if (bit)
|
|
99
|
+
value |= (1 << i);
|
|
100
|
+
pos++;
|
|
101
|
+
}
|
|
102
|
+
this.bitPosition = pos;
|
|
103
|
+
return value;
|
|
104
|
+
}
|
|
105
|
+
readInt(bytes) {
|
|
106
|
+
const totalBits = bytes << 3;
|
|
107
|
+
if (!this.isComplete) {
|
|
108
|
+
if (this.bitPosition + totalBits > this.totalAvailableBits) {
|
|
109
|
+
throw new Error(`Cannot read ${totalBits} bits at position ${this.bitPosition}, not enough bits available`);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
const data = this.byteArray;
|
|
113
|
+
let pos = this.bitPosition;
|
|
114
|
+
const bitOffset = pos & 7;
|
|
115
|
+
const byteIndex = pos >> 3;
|
|
116
|
+
let value = 0n;
|
|
117
|
+
if (bitOffset === 0) {
|
|
118
|
+
// Byte-aligned: fastest path
|
|
119
|
+
for (let i = 0; i < bytes; i++) {
|
|
120
|
+
value = (value << 8n) | BigInt(data[byteIndex + i]);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
else {
|
|
124
|
+
// Bit-unaligned: optimized bit extraction
|
|
125
|
+
const shift = 8 - bitOffset;
|
|
126
|
+
for (let i = 0; i < bytes; i++) {
|
|
127
|
+
const byte = (data[byteIndex + i] << bitOffset) | (data[byteIndex + i + 1] >> shift);
|
|
128
|
+
value = (value << 8n) | BigInt(byte & 0xFF);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
this.bitPosition = pos + totalBits;
|
|
132
|
+
return value;
|
|
133
|
+
}
|
|
134
|
+
// Specialized versions for common sizes (even faster)
|
|
135
|
+
readInt8() {
|
|
136
|
+
if (!this.isComplete) {
|
|
137
|
+
if (this.bitPosition + 8 > this.totalAvailableBits) {
|
|
138
|
+
throw new Error(`Cannot read 8 bits at position ${this.bitPosition}, not enough bits available`);
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
const data = this.byteArray;
|
|
142
|
+
let pos = this.bitPosition;
|
|
143
|
+
const bitOffset = pos & 7;
|
|
144
|
+
const byteIndex = pos >> 3;
|
|
145
|
+
let value;
|
|
146
|
+
if (bitOffset === 0) {
|
|
147
|
+
value = data[byteIndex];
|
|
148
|
+
}
|
|
149
|
+
else {
|
|
150
|
+
const shift = 8 - bitOffset;
|
|
151
|
+
value = ((data[byteIndex] << bitOffset) | (data[byteIndex + 1] >> shift)) & 0xFF;
|
|
152
|
+
}
|
|
153
|
+
this.bitPosition = pos + 8;
|
|
154
|
+
return (value << 24) >> 24;
|
|
155
|
+
}
|
|
156
|
+
readInt16() {
|
|
157
|
+
if (!this.isComplete) {
|
|
158
|
+
if (this.bitPosition + 16 > this.totalAvailableBits) {
|
|
159
|
+
throw new Error(`Cannot read 16 bits at position ${this.bitPosition}, not enough bits available`);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const data = this.byteArray;
|
|
163
|
+
let pos = this.bitPosition;
|
|
164
|
+
const bitOffset = pos & 7;
|
|
165
|
+
const byteIndex = pos >> 3;
|
|
166
|
+
let value;
|
|
167
|
+
if (bitOffset === 0) {
|
|
168
|
+
value = (data[byteIndex] << 8) | data[byteIndex + 1];
|
|
169
|
+
}
|
|
170
|
+
else {
|
|
171
|
+
const shift = 8 - bitOffset;
|
|
172
|
+
const byte0 = ((data[byteIndex] << bitOffset) | (data[byteIndex + 1] >> shift)) & 0xFF;
|
|
173
|
+
const byte1 = ((data[byteIndex + 1] << bitOffset) | (data[byteIndex + 2] >> shift)) & 0xFF;
|
|
174
|
+
value = (byte0 << 8) | byte1;
|
|
175
|
+
}
|
|
176
|
+
this.bitPosition = pos + 16;
|
|
177
|
+
return (value << 16) >> 16;
|
|
178
|
+
}
|
|
179
|
+
readInt32() {
|
|
180
|
+
if (!this.isComplete) {
|
|
181
|
+
if (this.bitPosition + 32 > this.totalAvailableBits) {
|
|
182
|
+
throw new Error(`Cannot read 32 bits at position ${this.bitPosition}, not enough bits available`);
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
const data = this.byteArray;
|
|
186
|
+
let pos = this.bitPosition;
|
|
187
|
+
const bitOffset = pos & 7;
|
|
188
|
+
const byteIndex = pos >> 3;
|
|
189
|
+
let value;
|
|
190
|
+
if (bitOffset === 0) {
|
|
191
|
+
value = (data[byteIndex] << 24) | (data[byteIndex + 1] << 16) |
|
|
192
|
+
(data[byteIndex + 2] << 8) | data[byteIndex + 3];
|
|
193
|
+
}
|
|
194
|
+
else {
|
|
195
|
+
const shift = 8 - bitOffset;
|
|
196
|
+
const byte0 = ((data[byteIndex] << bitOffset) | (data[byteIndex + 1] >> shift)) & 0xFF;
|
|
197
|
+
const byte1 = ((data[byteIndex + 1] << bitOffset) | (data[byteIndex + 2] >> shift)) & 0xFF;
|
|
198
|
+
const byte2 = ((data[byteIndex + 2] << bitOffset) | (data[byteIndex + 3] >> shift)) & 0xFF;
|
|
199
|
+
const byte3 = ((data[byteIndex + 3] << bitOffset) | (data[byteIndex + 4] >> shift)) & 0xFF;
|
|
200
|
+
value = (byte0 << 24) | (byte1 << 16) | (byte2 << 8) | byte3;
|
|
201
|
+
}
|
|
202
|
+
this.bitPosition = pos + 32;
|
|
203
|
+
return value;
|
|
204
|
+
}
|
|
205
|
+
readBigInt() {
|
|
206
|
+
let result = 0n;
|
|
207
|
+
let shift = 0n;
|
|
208
|
+
let currentBitPos = this.bitPosition;
|
|
209
|
+
let byte;
|
|
210
|
+
do {
|
|
211
|
+
const byteIndex = currentBitPos >> 3;
|
|
212
|
+
const bitOffset = currentBitPos & 7;
|
|
213
|
+
if (bitOffset === 0) {
|
|
214
|
+
byte = this.byteArray[byteIndex];
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
const shift_amount = 8 - bitOffset;
|
|
218
|
+
const mask = 0xFF >> bitOffset;
|
|
219
|
+
const part1 = (this.byteArray[byteIndex] & mask) << bitOffset;
|
|
220
|
+
const part2 = this.byteArray[byteIndex + 1] >> shift_amount;
|
|
221
|
+
byte = part1 | part2;
|
|
222
|
+
}
|
|
223
|
+
result |= BigInt(byte & 0x7F) << shift;
|
|
224
|
+
shift += 7n;
|
|
225
|
+
currentBitPos += 8;
|
|
226
|
+
} while ((byte & 0x80) !== 0);
|
|
227
|
+
this.bitPosition = currentBitPos;
|
|
228
|
+
return (result & 1n) === 0n ? result >> 1n : -((result + 1n) >> 1n);
|
|
229
|
+
}
|
|
230
|
+
readFloat32() {
|
|
231
|
+
const data = this.byteArray;
|
|
232
|
+
let pos = this.bitPosition;
|
|
233
|
+
const bitOffset = pos & 7;
|
|
234
|
+
const byteIndex = pos >> 3;
|
|
235
|
+
if (bitOffset === 0) {
|
|
236
|
+
// Byte-aligned: fastest path
|
|
237
|
+
this._shared_uint8_array[0] = data[byteIndex];
|
|
238
|
+
this._shared_uint8_array[1] = data[byteIndex + 1];
|
|
239
|
+
this._shared_uint8_array[2] = data[byteIndex + 2];
|
|
240
|
+
this._shared_uint8_array[3] = data[byteIndex + 3];
|
|
241
|
+
}
|
|
242
|
+
else {
|
|
243
|
+
// Bit-unaligned: optimized bit extraction
|
|
244
|
+
const shift = 8 - bitOffset;
|
|
245
|
+
this._shared_uint8_array[0] = (data[byteIndex] << bitOffset) | (data[byteIndex + 1] >> shift);
|
|
246
|
+
this._shared_uint8_array[1] = (data[byteIndex + 1] << bitOffset) | (data[byteIndex + 2] >> shift);
|
|
247
|
+
this._shared_uint8_array[2] = (data[byteIndex + 2] << bitOffset) | (data[byteIndex + 3] >> shift);
|
|
248
|
+
this._shared_uint8_array[3] = (data[byteIndex + 3] << bitOffset) | (data[byteIndex + 4] >> shift);
|
|
249
|
+
}
|
|
250
|
+
this.bitPosition = pos + 32;
|
|
251
|
+
return this._shared_float_32_array[0];
|
|
252
|
+
}
|
|
253
|
+
// readFloat32(): number {
|
|
254
|
+
// const uint32 = Number(this.readInt(4));
|
|
255
|
+
// const buffer = new ArrayBuffer(4);
|
|
256
|
+
// const view = new DataView(buffer);
|
|
257
|
+
// view.setUint32(0, uint32, true);
|
|
258
|
+
// return view.getFloat32(0, true);
|
|
259
|
+
// }
|
|
260
|
+
readFloat64() {
|
|
261
|
+
const data = this.byteArray;
|
|
262
|
+
let pos = this.bitPosition;
|
|
263
|
+
const bitOffset = pos & 7;
|
|
264
|
+
const byteIndex = pos >> 3;
|
|
265
|
+
if (bitOffset === 0) {
|
|
266
|
+
// Byte-aligned: fastest path
|
|
267
|
+
this._shared_uint8_array[0] = data[byteIndex];
|
|
268
|
+
this._shared_uint8_array[1] = data[byteIndex + 1];
|
|
269
|
+
this._shared_uint8_array[2] = data[byteIndex + 2];
|
|
270
|
+
this._shared_uint8_array[3] = data[byteIndex + 3];
|
|
271
|
+
this._shared_uint8_array[4] = data[byteIndex + 4];
|
|
272
|
+
this._shared_uint8_array[5] = data[byteIndex + 5];
|
|
273
|
+
this._shared_uint8_array[6] = data[byteIndex + 6];
|
|
274
|
+
this._shared_uint8_array[7] = data[byteIndex + 7];
|
|
275
|
+
}
|
|
276
|
+
else {
|
|
277
|
+
// Bit-unaligned: optimized bit extraction
|
|
278
|
+
const shift = 8 - bitOffset;
|
|
279
|
+
this._shared_uint8_array[0] = (data[byteIndex] << bitOffset) | (data[byteIndex + 1] >> shift);
|
|
280
|
+
this._shared_uint8_array[1] = (data[byteIndex + 1] << bitOffset) | (data[byteIndex + 2] >> shift);
|
|
281
|
+
this._shared_uint8_array[2] = (data[byteIndex + 2] << bitOffset) | (data[byteIndex + 3] >> shift);
|
|
282
|
+
this._shared_uint8_array[3] = (data[byteIndex + 3] << bitOffset) | (data[byteIndex + 4] >> shift);
|
|
283
|
+
this._shared_uint8_array[4] = (data[byteIndex + 4] << bitOffset) | (data[byteIndex + 5] >> shift);
|
|
284
|
+
this._shared_uint8_array[5] = (data[byteIndex + 5] << bitOffset) | (data[byteIndex + 6] >> shift);
|
|
285
|
+
this._shared_uint8_array[6] = (data[byteIndex + 6] << bitOffset) | (data[byteIndex + 7] >> shift);
|
|
286
|
+
this._shared_uint8_array[7] = (data[byteIndex + 7] << bitOffset) | (data[byteIndex + 8] >> shift);
|
|
287
|
+
}
|
|
288
|
+
this.bitPosition = pos + 64;
|
|
289
|
+
return this._shared_float_64_array[0];
|
|
290
|
+
}
|
|
291
|
+
readString() {
|
|
292
|
+
const bytes = [];
|
|
293
|
+
while (true) {
|
|
294
|
+
const byte = this.readByte();
|
|
295
|
+
if (byte === 0)
|
|
296
|
+
break;
|
|
297
|
+
bytes.push(byte);
|
|
298
|
+
}
|
|
299
|
+
return new TextDecoder().decode(new Uint8Array(bytes));
|
|
300
|
+
}
|
|
301
|
+
canReadBits(size, throwIfNotEnough = false) {
|
|
302
|
+
const enough = (this.bitPosition + size) <= this.totalAvailableBits;
|
|
303
|
+
if (!enough && throwIfNotEnough) {
|
|
304
|
+
throw new Error(`Cannot read ${size} bits at position ${this.bitPosition}, not enough bits available`);
|
|
305
|
+
}
|
|
306
|
+
return enough;
|
|
307
|
+
}
|
|
308
|
+
canReadString(throwIfNotEnough = false) {
|
|
309
|
+
let tempPos = this.bitPosition;
|
|
310
|
+
while (true) {
|
|
311
|
+
if (tempPos + 8 > this.totalAvailableBits) {
|
|
312
|
+
if (throwIfNotEnough) {
|
|
313
|
+
throw new Error(`Cannot read string at position ${this.bitPosition}, not enough bits available`);
|
|
314
|
+
}
|
|
315
|
+
return false;
|
|
316
|
+
}
|
|
317
|
+
let isZero = true;
|
|
318
|
+
for (let i = 0; i < 8; i++) {
|
|
319
|
+
const byteIndex = tempPos >>> 3;
|
|
320
|
+
const bitIndex = 7 - (tempPos & 7);
|
|
321
|
+
const bit = (this.byteArray[byteIndex] >> bitIndex) & 1;
|
|
322
|
+
if (bit === 1) {
|
|
323
|
+
isZero = false;
|
|
324
|
+
tempPos += 8 - i;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
tempPos++;
|
|
328
|
+
}
|
|
329
|
+
if (isZero)
|
|
330
|
+
return true;
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
getAvailableBits() {
|
|
334
|
+
return this.totalAvailableBits - this.bitPosition;
|
|
335
|
+
}
|
|
336
|
+
isDataComplete() {
|
|
337
|
+
return this.isComplete;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
exports.BitStreamReader = BitStreamReader;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare class BitStreamWriter {
|
|
2
|
+
private deletePreviousDataOnGetFixedBytes;
|
|
3
|
+
private bufferByte;
|
|
4
|
+
private bufferSize;
|
|
5
|
+
private byteArray;
|
|
6
|
+
private bitPosition;
|
|
7
|
+
private nextFixedBytePosition;
|
|
8
|
+
private guaranteedCapacity;
|
|
9
|
+
private static textEncoder;
|
|
10
|
+
private _shared_array_buffer;
|
|
11
|
+
private _shared_float_64_array;
|
|
12
|
+
private _shared_float_32_array;
|
|
13
|
+
private _shared_uint8_array;
|
|
14
|
+
private _shared_data_view;
|
|
15
|
+
constructor(deletePreviousDataOnGetFixedBytes?: boolean);
|
|
16
|
+
clear(): void;
|
|
17
|
+
ensureCapacity(newBits: number): void;
|
|
18
|
+
writeBit(bit: 0 | 1): void;
|
|
19
|
+
writeBits(bits: (0 | 1)[]): void;
|
|
20
|
+
private writeIntBytes;
|
|
21
|
+
writeInt8(value: number): void;
|
|
22
|
+
writeInt16(value: number): void;
|
|
23
|
+
writeInt32(value: number): void;
|
|
24
|
+
writeBigInt(value: bigint): void;
|
|
25
|
+
dumpBytes(label: string, bytes: Uint8Array): void;
|
|
26
|
+
writeFloat32(value: number): void;
|
|
27
|
+
writeFloat64(value: number): void;
|
|
28
|
+
writeString(value: string, end?: number): void;
|
|
29
|
+
removeBits(count: number): void;
|
|
30
|
+
getBytes(): Uint8Array<ArrayBuffer>;
|
|
31
|
+
getNextFixedBytes(): Uint8Array<ArrayBufferLike>;
|
|
32
|
+
getRemainingBytesAfterFixed(): Uint8Array<ArrayBuffer>;
|
|
33
|
+
getNextFixedBuffer(): Buffer<ArrayBuffer>;
|
|
34
|
+
getRemainingBufferAfterFixed(): Buffer<ArrayBuffer>;
|
|
35
|
+
getBuffer(): Buffer<ArrayBuffer>;
|
|
36
|
+
}
|