bireader 1.0.26 → 1.0.28

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.
@@ -1,4405 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bireader = void 0;
4
- const common_js_1 = require("./common.js");
5
- /**
6
- * Binary reader, includes bitfields and strings
7
- *
8
- * @param {Buffer|Uint8Array} data - ```Buffer``` or ```Uint8Array```. Always found in ``biwriter.data``
9
- * @param {number} byteOffset - Byte offset to start reader (default 0)
10
- * @param {number} bitOffset - Bit offset 0-7 to start reader (default 0)
11
- * @param {string} endianness - Endianness ```big``` or ```little``` (default ```little```)
12
- * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default true)
13
- */
14
- class bireader {
15
- isBufferOrUint8Array(obj) {
16
- return (0, common_js_1.arraybuffcheck)(this, obj);
17
- }
18
- extendArray(to_padd) {
19
- return (0, common_js_1.extendarray)(this, to_padd);
20
- }
21
- /**
22
- * Binary reader, includes bitfields and strings
23
- *
24
- * @param {Buffer|Uint8Array} data - ```Buffer``` or ```Uint8Array```. Always found in ``biwriter.data``
25
- * @param {number} byteOffset - Byte offset to start reader (default 0)
26
- * @param {number} bitOffset - Bit offset 0-7 to start reader (default 0)
27
- * @param {string} endianness - Endianness ```big``` or ```little``` (default ```little```)
28
- * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default true)
29
- */
30
- constructor(data, byteOffset, bitOffset, endianness, strict) {
31
- this.endian = "little";
32
- this.offset = 0;
33
- this.bitoffset = 0;
34
- this.size = 0;
35
- this.strict = false;
36
- this.errorDump = true;
37
- this.data = [];
38
- if (endianness != undefined && typeof endianness != "string") {
39
- throw new Error("Endian must be big or little");
40
- }
41
- if (endianness != undefined && !(endianness == "big" || endianness == "little")) {
42
- throw new Error("Byte order must be big or little");
43
- }
44
- this.endian = endianness || "little";
45
- if (byteOffset != undefined) {
46
- if (typeof byteOffset == "number") {
47
- this.offset = Math.round(byteOffset) || 0;
48
- }
49
- else {
50
- throw new Error("Byte offset must be number");
51
- }
52
- }
53
- if (bitOffset != undefined) {
54
- this.bitoffset = bitOffset % 8;
55
- }
56
- if (typeof strict == "boolean") {
57
- this.strict = strict;
58
- }
59
- else {
60
- if (strict != undefined) {
61
- throw new Error("Strict mode must be true of false");
62
- }
63
- }
64
- if (data == undefined) {
65
- throw new Error("Data required");
66
- }
67
- else {
68
- if (!this.isBufferOrUint8Array(data)) {
69
- throw new Error("Write data must be Uint8Array or Buffer");
70
- }
71
- }
72
- this.size = data.length + ((bitOffset || 0) % 8);
73
- this.data = data;
74
- }
75
- /**
76
- *
77
- * Change endian, defaults to little
78
- *
79
- * Can be changed at any time, doesn't loose position
80
- *
81
- * @param {string} endian - endianness ```big``` or ```little```
82
- */
83
- endianness(endian) {
84
- if (endian == undefined || typeof endian != "string") {
85
- throw new Error("Endian must be big or little");
86
- }
87
- if (endian != undefined && !(endian == "big" || endian == "little")) {
88
- throw new Error("Endian must be big or little");
89
- }
90
- this.endian = endian;
91
- }
92
- /**
93
- *Sets endian to big
94
- */
95
- bigEndian() {
96
- this.endianness("big");
97
- }
98
- /**
99
- *Sets endian to big
100
- */
101
- big() {
102
- this.endianness("big");
103
- }
104
- /**
105
- *Sets endian to big
106
- */
107
- be() {
108
- this.endianness("big");
109
- }
110
- /**
111
- * Sets endian to little
112
- */
113
- littleEndian() {
114
- this.endianness("little");
115
- }
116
- /**
117
- * Sets endian to little
118
- */
119
- little() {
120
- this.endianness("little");
121
- }
122
- /**
123
- * Sets endian to little
124
- */
125
- le() {
126
- this.endianness("little");
127
- }
128
- //
129
- // move from current position
130
- //
131
- /**
132
- * Offset current byte or bit position
133
- * Note: Will extend array if strict mode is off and outside of max size
134
- *
135
- * @param {number} bytes - Bytes to skip
136
- * @param {number} bits - Bits to skip (0-7)
137
- */
138
- skip(bytes, bits) {
139
- return (0, common_js_1.skip)(this, bytes, bits);
140
- }
141
- /**
142
- * Offset current byte or bit position
143
- * Note: Will extend array if strict mode is off and outside of max size
144
- *
145
- * @param {number} bytes - Bytes to skip
146
- * @param {number} bits - Bits to skip (0-7)
147
- */
148
- jump(bytes, bits) {
149
- this.skip(bytes, bits);
150
- }
151
- //
152
- // directly set current position
153
- //
154
- /**
155
- * Change position directly to address
156
- * Note: Will extend array if strict mode is off and outside of max size
157
- *
158
- * @param {number} byte - byte to set to
159
- * @param {number} bit - bit to set to (0-7)
160
- */
161
- goto(byte, bit) {
162
- return (0, common_js_1.goto)(this, byte, bit);
163
- }
164
- /**
165
- * Offset current byte or bit position
166
- * Note: Will extend array if strict mode is off and outside of max size
167
- *
168
- * @param {number} bytes - Bytes to skip
169
- * @param {number} bits - Bits to skip (0-7)
170
- */
171
- seek(bytes, bits) {
172
- return this.skip(bytes, bits);
173
- }
174
- /**
175
- * Change position directly to address
176
- * Note: Will extend array if strict mode is off and outside of max size
177
- *
178
- * @param {number} byte - byte to set to
179
- * @param {number} bit - bit to set to (0-7)
180
- */
181
- pointer(byte, bit) {
182
- return this.goto(byte, bit);
183
- }
184
- /**
185
- * Change position directly to address
186
- * Note: Will extend array if strict mode is off and outside of max size
187
- *
188
- * @param {number} byte - byte to set to
189
- * @param {number} bit - bit to set to (0-7)
190
- */
191
- warp(byte, bit) {
192
- return this.goto(byte, bit);
193
- }
194
- //
195
- //go to start
196
- //
197
- /**
198
- * Set byte and bit position to start of data
199
- */
200
- rewind() {
201
- this.offset = 0;
202
- this.bitoffset = 0;
203
- }
204
- /**
205
- * Set byte and bit position to start of data
206
- */
207
- gotostart() {
208
- this.offset = 0;
209
- this.bitoffset = 0;
210
- }
211
- //
212
- //get position
213
- //
214
- /**
215
- * Get the current byte position
216
- *
217
- * @return {number} current byte position
218
- */
219
- tell() {
220
- return this.offset;
221
- }
222
- /**
223
- * Get the current byte position
224
- *
225
- * @return {number} current byte position
226
- */
227
- getOffset() {
228
- return this.offset;
229
- }
230
- /**
231
- * Get the current byte position
232
- *
233
- * @return {number} current byte position
234
- */
235
- saveOffset() {
236
- return this.offset;
237
- }
238
- /**
239
- * Get the current bit position (0-7)
240
- *
241
- * @return {number} current bit position
242
- */
243
- tellB() {
244
- return this.bitoffset;
245
- }
246
- /**
247
- * Get the current bit position (0-7)
248
- *
249
- * @return {number} current bit position
250
- */
251
- getOffsetBit() {
252
- return this.bitoffset;
253
- }
254
- /**
255
- * Get the current bit position (0-7)
256
- *
257
- * @return {number} current bit position
258
- */
259
- saveOffsetAbsBit() {
260
- return (this.offset * 8) + this.bitoffset;
261
- }
262
- /**
263
- * Get the current absolute bit position (from start of data)
264
- *
265
- * @return {number} current absolute bit position
266
- */
267
- tellAbsB() {
268
- return (this.offset * 8) + this.bitoffset;
269
- }
270
- /**
271
- * Get the current absolute bit position (from start of data)
272
- *
273
- * @return {number} current absolute bit position
274
- */
275
- getOffsetAbsBit() {
276
- return (this.offset * 8) + this.bitoffset;
277
- }
278
- /**
279
- * Get the current absolute bit position (from start of data)
280
- *
281
- * @return {number} current absolute bit position
282
- */
283
- saveOffsetBit() {
284
- return (this.offset * 8) + this.bitoffset;
285
- }
286
- //
287
- //strict mode change
288
- //
289
- /**
290
- * Disallows extending data if position is outside of max size
291
- */
292
- restrict() {
293
- this.strict = true;
294
- }
295
- /**
296
- * Allows extending data if position is outside of max size
297
- */
298
- unrestrict() {
299
- this.strict = false;
300
- }
301
- //
302
- //math
303
- //
304
- /**
305
- * XOR data
306
- *
307
- * @param {number|string|Uint8Array|Buffer} xorKey - Value, string or array to XOR
308
- * @param {number} startOffset - Start location (default current byte position)
309
- * @param {number} endOffset - End location (default end of data)
310
- * @param {boolean} consume - Move current position to end of data (default false)
311
- */
312
- xor(xorKey, startOffset, endOffset, consume) {
313
- var XORKey = xorKey;
314
- if (typeof xorKey == "number") {
315
- //pass
316
- }
317
- else if (typeof xorKey == "string") {
318
- xorKey = new TextEncoder().encode(xorKey);
319
- }
320
- else if (this.isBufferOrUint8Array(XORKey)) {
321
- //pass
322
- }
323
- else {
324
- throw new Error("XOR must be a number, string, Uint8Array or Buffer");
325
- }
326
- return (0, common_js_1.XOR)(this, xorKey, startOffset || this.offset, endOffset || this.size, consume || false);
327
- }
328
- /**
329
- * XOR data
330
- *
331
- * @param {number|string|Uint8Array|Buffer} xorKey - Value, string or array to XOR
332
- * @param {number} length - Length in bytes to XOR from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
333
- * @param {boolean} consume - Move current position to end of data (default false)
334
- */
335
- xorThis(xorKey, length, consume) {
336
- var Length = length || 1;
337
- var XORKey = xorKey;
338
- if (typeof xorKey == "number") {
339
- Length = length || 1;
340
- }
341
- else if (typeof xorKey == "string") {
342
- const encoder = new TextEncoder().encode(xorKey);
343
- XORKey = encoder;
344
- Length = length || encoder.length;
345
- }
346
- else if (this.isBufferOrUint8Array(XORKey)) {
347
- Length = length || xorKey.length;
348
- }
349
- else {
350
- throw new Error("XOR must be a number, string, Uint8Array or Buffer");
351
- }
352
- return (0, common_js_1.XOR)(this, XORKey, this.offset, this.offset + Length, consume || false);
353
- }
354
- /**
355
- * OR data
356
- *
357
- * @param {number|string|Uint8Array|Buffer} orKey - Value, string or array to OR
358
- * @param {number} startOffset - Start location (default current byte position)
359
- * @param {number} endOffset - End location (default end of data)
360
- * @param {boolean} consume - Move current position to end of data (default false)
361
- */
362
- or(orKey, startOffset, endOffset, consume) {
363
- var ORKey = orKey;
364
- if (typeof orKey == "number") {
365
- //pass
366
- }
367
- else if (typeof orKey == "string") {
368
- orKey = new TextEncoder().encode(orKey);
369
- }
370
- else if (this.isBufferOrUint8Array(ORKey)) {
371
- //pass
372
- }
373
- else {
374
- throw new Error("OR must be a number, string, Uint8Array or Buffer");
375
- }
376
- return (0, common_js_1.OR)(this, orKey, startOffset || this.offset, endOffset || this.size, consume || false);
377
- }
378
- /**
379
- * OR data
380
- *
381
- * @param {number|string|Uint8Array|Buffer} orKey - Value, string or array to OR
382
- * @param {number} length - Length in bytes to OR from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
383
- * @param {boolean} consume - Move current position to end of data (default false)
384
- */
385
- orThis(orKey, length, consume) {
386
- var Length = length || 1;
387
- var ORKey = orKey;
388
- if (typeof orKey == "number") {
389
- Length = length || 1;
390
- }
391
- else if (typeof orKey == "string") {
392
- const encoder = new TextEncoder().encode(orKey);
393
- ORKey = encoder;
394
- Length = length || encoder.length;
395
- }
396
- else if (this.isBufferOrUint8Array(ORKey)) {
397
- Length = length || orKey.length;
398
- }
399
- else {
400
- throw new Error("OR must be a number, string, Uint8Array or Buffer");
401
- }
402
- return (0, common_js_1.OR)(this, ORKey, this.offset, this.offset + Length, consume || false);
403
- }
404
- /**
405
- * AND data
406
- *
407
- * @param {number|string|Array<number>|Buffer} andKey - Value, string or array to AND
408
- * @param {number} startOffset - Start location (default current byte position)
409
- * @param {number} endOffset - End location (default end of data)
410
- * @param {boolean} consume - Move current position to end of data (default false)
411
- */
412
- and(andKey, startOffset, endOffset, consume) {
413
- var ANDKey = andKey;
414
- if (typeof ANDKey == "number") {
415
- //pass
416
- }
417
- else if (typeof ANDKey == "string") {
418
- ANDKey = new TextEncoder().encode(ANDKey);
419
- }
420
- else if (typeof ANDKey == "object") {
421
- //pass
422
- }
423
- else {
424
- throw new Error("AND must be a number, string, number array or Buffer");
425
- }
426
- return (0, common_js_1.AND)(this, andKey, startOffset || this.offset, endOffset || this.size, consume || false);
427
- }
428
- /**
429
- * AND data
430
- *
431
- * @param {number|string|Array<number>|Buffer} andKey - Value, string or array to AND
432
- * @param {number} length - Length in bytes to AND from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
433
- * @param {boolean} consume - Move current position to end of data (default false)
434
- */
435
- andThis(andKey, length, consume) {
436
- var Length = length || 1;
437
- var ANDKey = andKey;
438
- if (typeof andKey == "number") {
439
- Length = length || 1;
440
- }
441
- else if (typeof andKey == "string") {
442
- const encoder = new TextEncoder().encode(andKey);
443
- ANDKey = encoder;
444
- Length = length || encoder.length;
445
- }
446
- else if (typeof andKey == "object") {
447
- Length = length || andKey.length;
448
- }
449
- else {
450
- throw new Error("AND must be a number, string, number array or Buffer");
451
- }
452
- return (0, common_js_1.AND)(this, ANDKey, this.offset, this.offset + Length, consume || false);
453
- }
454
- /**
455
- * Not data
456
- *
457
- * @param {number} startOffset - Start location (default current byte position)
458
- * @param {number} endOffset - End location (default end of data)
459
- * @param {boolean} consume - Move current position to end of data (default false)
460
- */
461
- not(startOffset, endOffset, consume) {
462
- return (0, common_js_1.NOT)(this, startOffset || this.offset, endOffset || this.size, consume || false);
463
- }
464
- /**
465
- * Not data
466
- *
467
- * @param {number} length - Length in bytes to NOT from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
468
- * @param {boolean} consume - Move current position to end of data (default false)
469
- */
470
- notThis(length, consume) {
471
- return (0, common_js_1.NOT)(this, this.offset, this.offset + (length || 1), consume || false);
472
- }
473
- /**
474
- * Left shift data
475
- *
476
- * @param {number|string|Array<number>|Buffer} shiftKey - Value, string or array to left shift data
477
- * @param {number} startOffset - Start location (default current byte position)
478
- * @param {number} endOffset - End location (default end of data)
479
- * @param {boolean} consume - Move current position to end of data (default false)
480
- */
481
- lShift(shiftKey, startOffset, endOffset, consume) {
482
- var lShiftKey = shiftKey;
483
- if (typeof lShiftKey == "number") {
484
- //pass
485
- }
486
- else if (typeof lShiftKey == "string") {
487
- lShiftKey = new TextEncoder().encode(lShiftKey);
488
- }
489
- else if (typeof lShiftKey == "object") {
490
- //pass
491
- }
492
- else {
493
- throw new Error("Left shift must be a number, string, number array or Buffer");
494
- }
495
- return (0, common_js_1.LSHIFT)(this, lShiftKey, startOffset || this.offset, endOffset || this.size, consume || false);
496
- }
497
- /**
498
- * Left shift data
499
- *
500
- * @param {number|string|Array<number>|Buffer} shiftKey - Value, string or array to left shift data
501
- * @param {number} length - Length in bytes to left shift from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
502
- * @param {boolean} consume - Move current position to end of data (default false)
503
- */
504
- lShiftThis(shiftKey, length, consume) {
505
- var Length = length || 1;
506
- var lShiftKey = shiftKey;
507
- if (typeof lShiftKey == "number") {
508
- Length = length || 1;
509
- }
510
- else if (typeof lShiftKey == "string") {
511
- const encoder = new TextEncoder().encode(lShiftKey);
512
- lShiftKey = encoder;
513
- Length = length || encoder.length;
514
- }
515
- else if (typeof lShiftKey == "object") {
516
- Length = length || lShiftKey.length;
517
- }
518
- else {
519
- throw new Error("Left shift must be a number, string, number array or Buffer");
520
- }
521
- return (0, common_js_1.LSHIFT)(this, shiftKey, this.offset, this.offset + Length, consume || false);
522
- }
523
- /**
524
- * Right shift data
525
- *
526
- * @param {number|string|Array<number>|Buffer} shiftKey - Value, string or array to right shift data
527
- * @param {number} startOffset - Start location (default current byte position)
528
- * @param {number} endOffset - End location (default end of data)
529
- * @param {boolean} consume - Move current position to end of data (default false)
530
- */
531
- rShift(shiftKey, startOffset, endOffset, consume) {
532
- var rShiftKey = shiftKey;
533
- if (typeof rShiftKey == "number") {
534
- //pass
535
- }
536
- else if (typeof rShiftKey == "string") {
537
- rShiftKey = new TextEncoder().encode(rShiftKey);
538
- }
539
- else if (typeof rShiftKey == "object") {
540
- //pass
541
- }
542
- else {
543
- throw new Error("Right shift must be a number, string, number array or Buffer");
544
- }
545
- return (0, common_js_1.RSHIFT)(this, rShiftKey, startOffset || this.offset, endOffset || this.size, consume || false);
546
- }
547
- /**
548
- * Right shift data
549
- *
550
- * @param {number|string|Array<number>|Buffer} shiftKey - Value, string or array to right shift data
551
- * @param {number} length - Length in bytes to right shift from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
552
- * @param {boolean} consume - Move current position to end of data (default false)
553
- */
554
- rShiftThis(shiftKey, length, consume) {
555
- var Length = length || 1;
556
- var lShiftKey = shiftKey;
557
- if (typeof lShiftKey == "number") {
558
- Length = length || 1;
559
- }
560
- else if (typeof lShiftKey == "string") {
561
- const encoder = new TextEncoder().encode(lShiftKey);
562
- lShiftKey = encoder;
563
- Length = length || encoder.length;
564
- }
565
- else if (typeof lShiftKey == "object") {
566
- Length = length || lShiftKey.length;
567
- }
568
- else {
569
- throw new Error("Right shift must be a number, string, number array or Buffer");
570
- }
571
- return (0, common_js_1.RSHIFT)(this, lShiftKey, this.offset, this.offset + Length, consume || false);
572
- }
573
- /**
574
- * Add value to data
575
- *
576
- * @param {number|string|Array<number>|Buffer} addKey - Value, string or array to add to data
577
- * @param {number} startOffset - Start location (default current byte position)
578
- * @param {number} endOffset - End location (default end of data)
579
- * @param {boolean} consume - Move current position to end of data (default false)
580
- */
581
- add(addKey, startOffset, endOffset, consume) {
582
- var addedKey = addKey;
583
- if (typeof addedKey == "number") {
584
- //pass
585
- }
586
- else if (typeof addedKey == "string") {
587
- addedKey = new TextEncoder().encode(addedKey);
588
- }
589
- else if (typeof addedKey == "object") {
590
- //pass
591
- }
592
- else {
593
- throw new Error("Add key must be a number, string, number array or Buffer");
594
- }
595
- return (0, common_js_1.ADD)(this, addedKey, startOffset || this.offset, endOffset || this.size, consume || false);
596
- }
597
- /**
598
- * Add value to data
599
- *
600
- * @param {number|string|Array<number>|Buffer} addKey - Value, string or array to add to data
601
- * @param {number} length - Length in bytes to add from curent position (default 1 byte for value, length of string or array for Uint8Array or Buffer)
602
- * @param {boolean} consume - Move current position to end of data (default false)
603
- */
604
- addThis(addKey, length, consume) {
605
- var Length = length || 1;
606
- var AddedKey = addKey;
607
- if (typeof AddedKey == "number") {
608
- Length = length || 1;
609
- }
610
- else if (typeof AddedKey == "string") {
611
- const encoder = new TextEncoder().encode(AddedKey);
612
- AddedKey = encoder;
613
- Length = length || encoder.length;
614
- }
615
- else if (typeof AddedKey == "object") {
616
- Length = length || AddedKey.length;
617
- }
618
- else {
619
- throw new Error("Add key must be a number, string, number array or Buffer");
620
- }
621
- return (0, common_js_1.ADD)(this, AddedKey, this.offset, this.offset + Length, consume || false);
622
- }
623
- //
624
- //remove part of data
625
- //
626
- /**
627
- * Deletes part of data from start to current byte position unless supplied, returns removed
628
- * Note: Errors in strict mode
629
- *
630
- * @param {number} startOffset - Start location (default 0)
631
- * @param {number} endOffset - End location (default current position)
632
- * @param {boolean} consume - Move position to end of removed data (default false)
633
- * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
634
- */
635
- delete(startOffset, endOffset, consume) {
636
- return (0, common_js_1.remove)(this, startOffset || 0, endOffset || this.offset, consume || false, true);
637
- }
638
- /**
639
- * Deletes part of data from current byte position to end, returns removed
640
- * Note: Errors in strict mode
641
- *
642
- * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
643
- */
644
- clip() {
645
- return (0, common_js_1.remove)(this, this.offset, this.size, false, true);
646
- }
647
- /**
648
- * Deletes part of data from current byte position to end, returns removed
649
- * Note: Errors in strict mode
650
- *
651
- * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
652
- */
653
- trim() {
654
- return (0, common_js_1.remove)(this, this.offset, this.size, false, true);
655
- }
656
- /**
657
- * Deletes part of data from current byte position to supplied length, returns removed
658
- * Note: Errors in strict mode
659
- *
660
- * @param {number} length - Length of data in bytes to remove
661
- * @param {boolean} consume - Move position to end of removed data (default false)
662
- * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
663
- */
664
- crop(length, consume) {
665
- return (0, common_js_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, true);
666
- }
667
- /**
668
- * Deletes part of data from current position to supplied length, returns removed
669
- * Note: Only works in strict mode
670
- *
671
- * @param {number} length - Length of data in bytes to remove
672
- * @param {boolean} consume - Move position to end of removed data (default false)
673
- * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
674
- */
675
- drop(length, consume) {
676
- return (0, common_js_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, true);
677
- }
678
- //
679
- //copy out
680
- //
681
- /**
682
- * Returns part of data from current byte position to end of data unless supplied
683
- *
684
- * @param {number} startOffset - Start location (default current position)
685
- * @param {number} endOffset - End location (default end of data)
686
- * @param {boolean} consume - Move position to end of lifted data (default false)
687
- * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
688
- * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
689
- */
690
- lift(startOffset, endOffset, consume, fillValue) {
691
- return (0, common_js_1.remove)(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
692
- }
693
- /**
694
- * Returns part of data from current byte position to end of data unless supplied
695
- *
696
- * @param {number} startOffset - Start location (default current position)
697
- * @param {number} endOffset - End location (default end of data)
698
- * @param {boolean} consume - Move position to end of lifted data (default false)
699
- * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
700
- * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
701
- */
702
- fill(startOffset, endOffset, consume, fillValue) {
703
- return (0, common_js_1.remove)(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
704
- }
705
- /**
706
- * Extract data from current position to length supplied
707
- * Note: Does not affect supplied data
708
- *
709
- * @param {number} length - Length of data in bytes to copy from current offset
710
- * @param {number} consume - Moves offset to end of length
711
- * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
712
- */
713
- extract(length, consume) {
714
- return (0, common_js_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, false);
715
- }
716
- /**
717
- * Extract data from current position to length supplied
718
- * Note: Does not affect supplied data
719
- *
720
- * @param {number} length - Length of data in bytes to copy from current offset
721
- * @param {number} consume - Moves offset to end of length
722
- * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
723
- */
724
- slice(length, consume) {
725
- return (0, common_js_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, false);
726
- }
727
- /**
728
- * Extract data from current position to length supplied
729
- * Note: Does not affect supplied data
730
- *
731
- * @param {number} length - Length of data in bytes to copy from current offset
732
- * @param {number} consume - Moves offset to end of length
733
- * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
734
- */
735
- wrap(length, consume) {
736
- return (0, common_js_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, false);
737
- }
738
- //
739
- //insert
740
- //
741
- /**
742
- * Inserts data into data
743
- * Note: Must be same data type as supplied data. Errors on strict mode.
744
- *
745
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
746
- * @param {boolean} consume - Move current byte position to end of data (default false)
747
- * @param {number} offset - Byte position to add at (defaults to current position)
748
- */
749
- insert(data, consume, offset) {
750
- return (0, common_js_1.addData)(this, data, consume || false, offset || this.offset);
751
- }
752
- /**
753
- * Inserts data into data
754
- * Note: Must be same data type as supplied data. Errors on strict mode.
755
- *
756
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
757
- * @param {boolean} consume - Move current byte position to end of data (default false)
758
- * @param {number} offset - Byte position to add at (defaults to current position)
759
- */
760
- place(data, consume, offset) {
761
- return (0, common_js_1.addData)(this, data, consume || false, offset || this.offset);
762
- }
763
- /**
764
- * Replaces data in data
765
- * Note: Must be same data type as supplied data. Errors on strict mode.
766
- *
767
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to replace in data
768
- * @param {boolean} consume - Move current byte position to end of data (default false)
769
- * @param {number} offset - Offset to add it at (defaults to current position)
770
- */
771
- replace(data, consume, offset) {
772
- return (0, common_js_1.addData)(this, data, consume || false, offset || this.offset, true);
773
- }
774
- /**
775
- * Replaces data in data
776
- * Note: Must be same data type as supplied data. Errors on strict mode.
777
- *
778
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to replace in data
779
- * @param {boolean} consume - Move current byte position to end of data (default false)
780
- * @param {number} offset - Offset to add it at (defaults to current position)
781
- */
782
- overwrite(data, consume, offset) {
783
- return (0, common_js_1.addData)(this, data, consume || false, offset || this.offset, true);
784
- }
785
- /**
786
- * Adds data to start of supplied data
787
- * Note: Must be same data type as supplied data. Errors on strict mode.
788
- *
789
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
790
- * @param {boolean} consume - Move current write position to end of data (default false)
791
- */
792
- unshift(data, consume) {
793
- return (0, common_js_1.addData)(this, data, consume || false, 0);
794
- }
795
- /**
796
- * Adds data to start of supplied data
797
- * Note: Must be same data type as supplied data. Errors on strict mode.
798
- *
799
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
800
- * @param {boolean} consume - Move current write position to end of data (default false)
801
- */
802
- prepend(data, consume) {
803
- return (0, common_js_1.addData)(this, data, consume || false, 0);
804
- }
805
- /**
806
- * Adds data to end of supplied data
807
- * Note: Must be same data type as supplied data. Errors on strict mode.
808
- *
809
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
810
- * @param {boolean} consume - Move current write position to end of data (default false)
811
- */
812
- push(data, consume) {
813
- return (0, common_js_1.addData)(this, data, consume || false, this.size);
814
- }
815
- /**
816
- * Adds data to end of supplied data
817
- * Note: Must be same data type as supplied data. Errors on strict mode.
818
- *
819
- * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
820
- * @param {boolean} consume - Move current write position to end of data (default false)
821
- */
822
- append(data, consume) {
823
- return (0, common_js_1.addData)(this, data, consume || false, this.size);
824
- }
825
- //
826
- //finishing
827
- //
828
- /**
829
- * Returns current data
830
- *
831
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
832
- */
833
- get() {
834
- return this.data;
835
- }
836
- /**
837
- * Returns current data
838
- *
839
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
840
- */
841
- return() {
842
- return this.data;
843
- }
844
- /**
845
- * removes data
846
- */
847
- end() {
848
- this.data = undefined;
849
- }
850
- /**
851
- * removes data
852
- */
853
- close() {
854
- this.data = undefined;
855
- }
856
- /**
857
- * removes data
858
- */
859
- done() {
860
- this.data = undefined;
861
- }
862
- /**
863
- * removes data
864
- */
865
- finished() {
866
- this.data = undefined;
867
- }
868
- /**
869
- * Console logs data as hex dump
870
- *
871
- * @param {object} options
872
- * ```javascript
873
- * {
874
- * length: 192, // number of bytes to log, default 192 or end of data
875
- * startByte: 0, // byte to start dump (default current byte position)
876
- * supressUnicode: false // Supress unicode character preview for even columns
877
- * }
878
- * ```
879
- */
880
- hexdump(options) {
881
- return (0, common_js_1.hexDump)(this, options);
882
- }
883
- /**
884
- * Turn hexdump on error off (default on)
885
- */
886
- errorDumpOff() {
887
- this.errorDump = false;
888
- }
889
- /**
890
- * Turn hexdump on error on (default on)
891
- */
892
- errorDumpOn() {
893
- this.errorDump = true;
894
- }
895
- //
896
- //bit reader
897
- //
898
- /**
899
- *
900
- * Write bits, must have at least value and number of bits
901
- *
902
- * ``Note``: When returning to a byte write, remaining bits are skipped
903
- *
904
- * @param {number} value - value as int
905
- * @param {number} bits - number of bits to write
906
- * @param {boolean} unsigned - if value is unsigned
907
- * @param {string} endian - ``big`` or ``little``
908
- */
909
- writeBit(value, bits, unsigned, endian) {
910
- return (0, common_js_1.wbit)(this, value, bits, unsigned, endian);
911
- }
912
- /**
913
- * Bit field reader
914
- *
915
- * Note: When returning to a byte read, remaining bits are dropped
916
- *
917
- * @param {number} bits - bits to read
918
- * @param {boolean} unsigned - if the value is unsigned
919
- * @param {string} endian - ``big`` or ``little`
920
- * @returns number
921
- */
922
- readBit(bits, unsigned, endian) {
923
- return (0, common_js_1.rbit)(this, bits, unsigned, endian);
924
- }
925
- /**
926
- * Bit field reader
927
- *
928
- * Note: When returning to a byte read, remaining bits are dropped
929
- *
930
- * @param {number} bits - bits to read
931
- * @param {boolean} unsigned - if the value is unsigned
932
- * @param {string} endian - ``big`` or ``little`
933
- * @returns number
934
- */
935
- bit(bits, unsigned, endian) {
936
- return this.readBit(bits, unsigned, endian);
937
- }
938
- /**
939
- * Bit field reader
940
- *
941
- * Note: When returning to a byte read, remaining bits are dropped
942
- *
943
- * @param {boolean} unsigned - if the value is unsigned
944
- * @param {string} endian - ``big`` or ``little`
945
- * @returns number
946
- */
947
- bit1(unsigned, endian) {
948
- return this.bit(1, unsigned, endian);
949
- }
950
- /**
951
- * Bit field reader
952
- *
953
- * Note: When returning to a byte read, remaining bits are dropped
954
- *
955
- * @param {boolean} unsigned - if the value is unsigned
956
- * @returns number
957
- */
958
- bit1le(unsigned) {
959
- return this.bit(1, unsigned, "little");
960
- }
961
- /**
962
- * Bit field reader
963
- *
964
- * Note: When returning to a byte read, remaining bits are dropped
965
- *
966
- * @param {boolean} unsigned - if the value is unsigned
967
- * @returns number
968
- */
969
- bit1be(unsigned) {
970
- return this.bit(1, unsigned, "big");
971
- }
972
- /**
973
- * Bit field reader
974
- *
975
- * Note: When returning to a byte read, remaining bits are dropped
976
- *
977
- * @returns number
978
- */
979
- ubit1() {
980
- return this.bit(1, true);
981
- }
982
- /**
983
- * Bit field reader
984
- *
985
- * Note: When returning to a byte read, remaining bits are dropped
986
- *
987
- * @returns number
988
- */
989
- ubit1le() {
990
- return this.bit(1, true, "little");
991
- }
992
- /**
993
- * Bit field reader
994
- *
995
- * Note: When returning to a byte read, remaining bits are dropped
996
- *
997
- * @returns number
998
- */
999
- ubit1be() {
1000
- return this.bit(1, true, "big");
1001
- }
1002
- /**
1003
- * Bit field reader
1004
- *
1005
- * Note: When returning to a byte read, remaining bits are dropped
1006
- *
1007
- * @param {boolean} unsigned - if the value is unsigned
1008
- * @returns number
1009
- */
1010
- bit2(unsigned) {
1011
- return this.bit(2, unsigned);
1012
- }
1013
- /**
1014
- * Bit field reader
1015
- *
1016
- * Note: When returning to a byte read, remaining bits are dropped
1017
- *
1018
- * @param {boolean} unsigned - if the value is unsigned
1019
- * @returns number
1020
- */
1021
- bit2le(unsigned) {
1022
- return this.bit(2, unsigned, "little");
1023
- }
1024
- /**
1025
- * Bit field reader
1026
- *
1027
- * Note: When returning to a byte read, remaining bits are dropped
1028
- *
1029
- * @param {boolean} unsigned - if the value is unsigned
1030
- * @returns number
1031
- */
1032
- bit2be(unsigned) {
1033
- return this.bit(2, unsigned, "big");
1034
- }
1035
- /**
1036
- * Bit field reader
1037
- *
1038
- * Note: When returning to a byte read, remaining bits are dropped
1039
- *
1040
- * @returns number
1041
- */
1042
- ubit2() {
1043
- return this.bit(2, true);
1044
- }
1045
- /**
1046
- * Bit field reader
1047
- *
1048
- * Note: When returning to a byte read, remaining bits are dropped
1049
- *
1050
- * @returns number
1051
- */
1052
- ubit2le() {
1053
- return this.bit(2, true, "little");
1054
- }
1055
- /**
1056
- * Bit field reader
1057
- *
1058
- * Note: When returning to a byte read, remaining bits are dropped
1059
- *
1060
- * @returns number
1061
- */
1062
- ubit2be() {
1063
- return this.bit(2, true, "big");
1064
- }
1065
- /**
1066
- * Bit field reader
1067
- *
1068
- * Note: When returning to a byte read, remaining bits are dropped
1069
- *
1070
- * @param {boolean} unsigned - if the value is unsigned
1071
- * @returns number
1072
- */
1073
- bit3(unsigned) {
1074
- return this.bit(3, unsigned);
1075
- }
1076
- /**
1077
- * Bit field reader
1078
- *
1079
- * Note: When returning to a byte read, remaining bits are dropped
1080
- *
1081
- * @param {boolean} unsigned - if the value is unsigned
1082
- * @returns number
1083
- */
1084
- bit3le(unsigned) {
1085
- return this.bit(3, unsigned, "little");
1086
- }
1087
- /**
1088
- * Bit field reader
1089
- *
1090
- * Note: When returning to a byte read, remaining bits are dropped
1091
- *
1092
- * @param {boolean} unsigned - if the value is unsigned
1093
- * @returns number
1094
- */
1095
- bit3be(unsigned) {
1096
- return this.bit(3, unsigned, "big");
1097
- }
1098
- /**
1099
- * Bit field reader
1100
- *
1101
- * Note: When returning to a byte read, remaining bits are dropped
1102
- *
1103
- * @returns number
1104
- */
1105
- ubit3() {
1106
- return this.bit(3, true);
1107
- }
1108
- /**
1109
- * Bit field reader
1110
- *
1111
- * Note: When returning to a byte read, remaining bits are dropped
1112
- *
1113
- * @returns number
1114
- */
1115
- ubit3le() {
1116
- return this.bit(3, true, "little");
1117
- }
1118
- /**
1119
- * Bit field reader
1120
- *
1121
- * Note: When returning to a byte read, remaining bits are dropped
1122
- *
1123
- * @returns number
1124
- */
1125
- ubit3be() {
1126
- return this.bit(3, true, "big");
1127
- }
1128
- /**
1129
- * Bit field reader
1130
- *
1131
- * Note: When returning to a byte read, remaining bits are dropped
1132
- *
1133
- * @param {boolean} unsigned - if the value is unsigned
1134
- * @returns number
1135
- */
1136
- bit4(unsigned) {
1137
- return this.bit(4, unsigned);
1138
- }
1139
- /**
1140
- * Bit field reader
1141
- *
1142
- * Note: When returning to a byte read, remaining bits are dropped
1143
- *
1144
- * @param {boolean} unsigned - if the value is unsigned
1145
- * @returns number
1146
- */
1147
- bit4le(unsigned) {
1148
- return this.bit(4, unsigned, "little");
1149
- }
1150
- /**
1151
- * Bit field reader
1152
- *
1153
- * Note: When returning to a byte read, remaining bits are dropped
1154
- *
1155
- * @param {boolean} unsigned - if the value is unsigned
1156
- * @returns number
1157
- */
1158
- bit4be(unsigned) {
1159
- return this.bit(4, unsigned, "big");
1160
- }
1161
- /**
1162
- * Bit field reader
1163
- *
1164
- * Note: When returning to a byte read, remaining bits are dropped
1165
- *
1166
- * @returns number
1167
- */
1168
- ubit4() {
1169
- return this.bit(4, true);
1170
- }
1171
- /**
1172
- * Bit field reader
1173
- *
1174
- * Note: When returning to a byte read, remaining bits are dropped
1175
- *
1176
- * @returns number
1177
- */
1178
- ubit4le() {
1179
- return this.bit(4, true, "little");
1180
- }
1181
- /**
1182
- * Bit field reader
1183
- *
1184
- * Note: When returning to a byte read, remaining bits are dropped
1185
- *
1186
- * @returns number
1187
- */
1188
- ubit4be() {
1189
- return this.bit(4, true, "big");
1190
- }
1191
- /**
1192
- * Bit field reader
1193
- *
1194
- * Note: When returning to a byte read, remaining bits are dropped
1195
- *
1196
- * @param {boolean} unsigned - if the value is unsigned
1197
- * @returns number
1198
- */
1199
- bit5(unsigned) {
1200
- return this.bit(5, unsigned);
1201
- }
1202
- /**
1203
- * Bit field reader
1204
- *
1205
- * Note: When returning to a byte read, remaining bits are dropped
1206
- *
1207
- * @param {boolean} unsigned - if the value is unsigned
1208
- * @returns number
1209
- */
1210
- bit5le(unsigned) {
1211
- return this.bit(5, unsigned, "little");
1212
- }
1213
- /**
1214
- * Bit field reader
1215
- *
1216
- * Note: When returning to a byte read, remaining bits are dropped
1217
- *
1218
- * @param {boolean} unsigned - if the value is unsigned
1219
- * @returns number
1220
- */
1221
- bit5be(unsigned) {
1222
- return this.bit(5, unsigned, "big");
1223
- }
1224
- /**
1225
- * Bit field reader
1226
- *
1227
- * Note: When returning to a byte read, remaining bits are dropped
1228
- *
1229
- * @returns number
1230
- */
1231
- ubit5() {
1232
- return this.bit(5, true);
1233
- }
1234
- /**
1235
- * Bit field reader
1236
- *
1237
- * Note: When returning to a byte read, remaining bits are dropped
1238
- *
1239
- * @returns number
1240
- */
1241
- ubit5le() {
1242
- return this.bit(5, true, "little");
1243
- }
1244
- /**
1245
- * Bit field reader
1246
- *
1247
- * Note: When returning to a byte read, remaining bits are dropped
1248
- *
1249
- * @returns number
1250
- */
1251
- ubit5be() {
1252
- return this.bit(5, true, "big");
1253
- }
1254
- /**
1255
- * Bit field reader
1256
- *
1257
- * Note: When returning to a byte read, remaining bits are dropped
1258
- *
1259
- * @param {boolean} unsigned - if the value is unsigned
1260
- * @returns number
1261
- */
1262
- bit6(unsigned) {
1263
- return this.bit(6, unsigned);
1264
- }
1265
- /**
1266
- * Bit field reader
1267
- *
1268
- * Note: When returning to a byte read, remaining bits are dropped
1269
- *
1270
- * @param {boolean} unsigned - if the value is unsigned
1271
- * @returns number
1272
- */
1273
- bit6le(unsigned) {
1274
- return this.bit(6, unsigned, "little");
1275
- }
1276
- /**
1277
- * Bit field reader
1278
- *
1279
- * Note: When returning to a byte read, remaining bits are dropped
1280
- *
1281
- * @param {boolean} unsigned - if the value is unsigned
1282
- * @returns number
1283
- */
1284
- bit6be(unsigned) {
1285
- return this.bit(6, unsigned, "big");
1286
- }
1287
- /**
1288
- * Bit field reader
1289
- *
1290
- * Note: When returning to a byte read, remaining bits are dropped
1291
- *
1292
- * @returns number
1293
- */
1294
- ubit6() {
1295
- return this.bit(6, true);
1296
- }
1297
- /**
1298
- * Bit field reader
1299
- *
1300
- * Note: When returning to a byte read, remaining bits are dropped
1301
- *
1302
- * @returns number
1303
- */
1304
- ubit6le() {
1305
- return this.bit(6, true, "little");
1306
- }
1307
- /**
1308
- * Bit field reader
1309
- *
1310
- * Note: When returning to a byte read, remaining bits are dropped
1311
- *
1312
- * @returns number
1313
- */
1314
- ubit6be() {
1315
- return this.bit(6, true, "big");
1316
- }
1317
- /**
1318
- * Bit field reader
1319
- *
1320
- * Note: When returning to a byte read, remaining bits are dropped
1321
- *
1322
- * @param {boolean} unsigned - if the value is unsigned
1323
- * @returns number
1324
- */
1325
- bit7(unsigned) {
1326
- return this.bit(7, unsigned);
1327
- }
1328
- /**
1329
- * Bit field reader
1330
- *
1331
- * Note: When returning to a byte read, remaining bits are dropped
1332
- *
1333
- * @param {boolean} unsigned - if the value is unsigned
1334
- * @returns number
1335
- */
1336
- bit7le(unsigned) {
1337
- return this.bit(7, unsigned, "little");
1338
- }
1339
- /**
1340
- * Bit field reader
1341
- *
1342
- * Note: When returning to a byte read, remaining bits are dropped
1343
- *
1344
- * @param {boolean} unsigned - if the value is unsigned
1345
- * @returns number
1346
- */
1347
- bit7be(unsigned) {
1348
- return this.bit(7, unsigned, "big");
1349
- }
1350
- /**
1351
- * Bit field reader
1352
- *
1353
- * Note: When returning to a byte read, remaining bits are dropped
1354
- *
1355
- * @returns number
1356
- */
1357
- ubit7() {
1358
- return this.bit(7, true);
1359
- }
1360
- /**
1361
- * Bit field reader
1362
- *
1363
- * Note: When returning to a byte read, remaining bits are dropped
1364
- *
1365
- * @returns number
1366
- */
1367
- ubit7le() {
1368
- return this.bit(7, true, "little");
1369
- }
1370
- /**
1371
- * Bit field reader
1372
- *
1373
- * Note: When returning to a byte read, remaining bits are dropped
1374
- *
1375
- * @returns number
1376
- */
1377
- ubit7be() {
1378
- return this.bit(7, true, "big");
1379
- }
1380
- /**
1381
- * Bit field reader
1382
- *
1383
- * Note: When returning to a byte read, remaining bits are dropped
1384
- *
1385
- * @param {boolean} unsigned - if the value is unsigned
1386
- * @returns number
1387
- */
1388
- bit8(unsigned) {
1389
- return this.bit(8, unsigned);
1390
- }
1391
- /**
1392
- * Bit field reader
1393
- *
1394
- * Note: When returning to a byte read, remaining bits are dropped
1395
- *
1396
- * @param {boolean} unsigned - if the value is unsigned
1397
- * @returns number
1398
- */
1399
- bit8le(unsigned) {
1400
- return this.bit(8, unsigned, "little");
1401
- }
1402
- /**
1403
- * Bit field reader
1404
- *
1405
- * Note: When returning to a byte read, remaining bits are dropped
1406
- *
1407
- * @param {boolean} unsigned - if the value is unsigned
1408
- * @returns number
1409
- */
1410
- bit8be(unsigned) {
1411
- return this.bit(8, unsigned, "big");
1412
- }
1413
- /**
1414
- * Bit field reader
1415
- *
1416
- * Note: When returning to a byte read, remaining bits are dropped
1417
- *
1418
- * @returns number
1419
- */
1420
- ubit8() {
1421
- return this.bit(8, true);
1422
- }
1423
- /**
1424
- * Bit field reader
1425
- *
1426
- * Note: When returning to a byte read, remaining bits are dropped
1427
- *
1428
- * @returns number
1429
- */
1430
- ubit8le() {
1431
- return this.bit(8, true, "little");
1432
- }
1433
- /**
1434
- * Bit field reader
1435
- *
1436
- * Note: When returning to a byte read, remaining bits are dropped
1437
- *
1438
- * @returns number
1439
- */
1440
- ubit8be() {
1441
- return this.bit(8, true, "big");
1442
- }
1443
- /**
1444
- * Bit field reader
1445
- *
1446
- * Note: When returning to a byte read, remaining bits are dropped
1447
- *
1448
- * @param {boolean} unsigned - if the value is unsigned
1449
- * @returns number
1450
- */
1451
- bit9(unsigned) {
1452
- return this.bit(9, unsigned);
1453
- }
1454
- /**
1455
- * Bit field reader
1456
- *
1457
- * Note: When returning to a byte read, remaining bits are dropped
1458
- *
1459
- * @param {boolean} unsigned - if the value is unsigned
1460
- * @returns number
1461
- */
1462
- bit9le(unsigned) {
1463
- return this.bit(9, unsigned, "little");
1464
- }
1465
- /**
1466
- * Bit field reader
1467
- *
1468
- * Note: When returning to a byte read, remaining bits are dropped
1469
- *
1470
- * @param {boolean} unsigned - if the value is unsigned
1471
- * @returns number
1472
- */
1473
- bit9be(unsigned) {
1474
- return this.bit(9, unsigned, "big");
1475
- }
1476
- /**
1477
- * Bit field reader
1478
- *
1479
- * Note: When returning to a byte read, remaining bits are dropped
1480
- *
1481
- * @returns number
1482
- */
1483
- ubit9() {
1484
- return this.bit(9, true);
1485
- }
1486
- /**
1487
- * Bit field reader
1488
- *
1489
- * Note: When returning to a byte read, remaining bits are dropped
1490
- *
1491
- * @returns number
1492
- */
1493
- ubit9le() {
1494
- return this.bit(9, true, "little");
1495
- }
1496
- /**
1497
- * Bit field reader
1498
- *
1499
- * Note: When returning to a byte read, remaining bits are dropped
1500
- *
1501
- * @returns number
1502
- */
1503
- ubit9be() {
1504
- return this.bit(9, true, "big");
1505
- }
1506
- /**
1507
- * Bit field reader
1508
- *
1509
- * Note: When returning to a byte read, remaining bits are dropped
1510
- *
1511
- * @param {boolean} unsigned - if the value is unsigned
1512
- * @returns number
1513
- */
1514
- bit10(unsigned) {
1515
- return this.bit(10, unsigned);
1516
- }
1517
- /**
1518
- * Bit field reader
1519
- *
1520
- * Note: When returning to a byte read, remaining bits are dropped
1521
- *
1522
- * @param {boolean} unsigned - if the value is unsigned
1523
- * @returns number
1524
- */
1525
- bit10le(unsigned) {
1526
- return this.bit(10, unsigned, "little");
1527
- }
1528
- /**
1529
- * Bit field reader
1530
- *
1531
- * Note: When returning to a byte read, remaining bits are dropped
1532
- *
1533
- * @param {boolean} unsigned - if the value is unsigned
1534
- * @returns number
1535
- */
1536
- bit10be(unsigned) {
1537
- return this.bit(10, unsigned, "big");
1538
- }
1539
- /**
1540
- * Bit field reader
1541
- *
1542
- * Note: When returning to a byte read, remaining bits are dropped
1543
- *
1544
- * @returns number
1545
- */
1546
- ubit10() {
1547
- return this.bit(10, true);
1548
- }
1549
- /**
1550
- * Bit field reader
1551
- *
1552
- * Note: When returning to a byte read, remaining bits are dropped
1553
- *
1554
- * @returns number
1555
- */
1556
- ubit10le() {
1557
- return this.bit(10, true, "little");
1558
- }
1559
- /**
1560
- * Bit field reader
1561
- *
1562
- * Note: When returning to a byte read, remaining bits are dropped
1563
- *
1564
- * @returns number
1565
- */
1566
- ubit10be() {
1567
- return this.bit(10, true, "big");
1568
- }
1569
- /**
1570
- * Bit field reader
1571
- *
1572
- * Note: When returning to a byte read, remaining bits are dropped
1573
- *
1574
- * @param {boolean} unsigned - if the value is unsigned
1575
- * @returns number
1576
- */
1577
- bit11(unsigned) {
1578
- return this.bit(11, unsigned);
1579
- }
1580
- /**
1581
- * Bit field reader
1582
- *
1583
- * Note: When returning to a byte read, remaining bits are dropped
1584
- *
1585
- * @param {boolean} unsigned - if the value is unsigned
1586
- * @returns number
1587
- */
1588
- bit11le(unsigned) {
1589
- return this.bit(11, unsigned, "little");
1590
- }
1591
- /**
1592
- * Bit field reader
1593
- *
1594
- * Note: When returning to a byte read, remaining bits are dropped
1595
- *
1596
- * @param {boolean} unsigned - if the value is unsigned
1597
- * @returns number
1598
- */
1599
- bit11be(unsigned) {
1600
- return this.bit(11, unsigned, "big");
1601
- }
1602
- /**
1603
- * Bit field reader
1604
- *
1605
- * Note: When returning to a byte read, remaining bits are dropped
1606
- *
1607
- * @returns number
1608
- */
1609
- ubit11() {
1610
- return this.bit(11, true);
1611
- }
1612
- /**
1613
- * Bit field reader
1614
- *
1615
- * Note: When returning to a byte read, remaining bits are dropped
1616
- *
1617
- * @returns number
1618
- */
1619
- ubit11le() {
1620
- return this.bit(11, true, "little");
1621
- }
1622
- /**
1623
- * Bit field reader
1624
- *
1625
- * Note: When returning to a byte read, remaining bits are dropped
1626
- *
1627
- * @returns number
1628
- */
1629
- ubit11be() {
1630
- return this.bit(11, true, "big");
1631
- }
1632
- /**
1633
- * Bit field reader
1634
- *
1635
- * Note: When returning to a byte read, remaining bits are dropped
1636
- *
1637
- * @param {boolean} unsigned - if the value is unsigned
1638
- * @returns number
1639
- */
1640
- bit12(unsigned) {
1641
- return this.bit(12, unsigned);
1642
- }
1643
- /**
1644
- * Bit field reader
1645
- *
1646
- * Note: When returning to a byte read, remaining bits are dropped
1647
- *
1648
- * @param {boolean} unsigned - if the value is unsigned
1649
- * @returns number
1650
- */
1651
- bit12le(unsigned) {
1652
- return this.bit(12, unsigned, "little");
1653
- }
1654
- /**
1655
- * Bit field reader
1656
- *
1657
- * Note: When returning to a byte read, remaining bits are dropped
1658
- *
1659
- * @param {boolean} unsigned - if the value is unsigned
1660
- * @returns number
1661
- */
1662
- bit12be(unsigned) {
1663
- return this.bit(12, unsigned, "big");
1664
- }
1665
- /**
1666
- * Bit field reader
1667
- *
1668
- * Note: When returning to a byte read, remaining bits are dropped
1669
- *
1670
- * @returns number
1671
- */
1672
- ubit12() {
1673
- return this.bit(12, true);
1674
- }
1675
- /**
1676
- * Bit field reader
1677
- *
1678
- * Note: When returning to a byte read, remaining bits are dropped
1679
- *
1680
- * @returns number
1681
- */
1682
- ubit12le() {
1683
- return this.bit(12, true, "little");
1684
- }
1685
- /**
1686
- * Bit field reader
1687
- *
1688
- * Note: When returning to a byte read, remaining bits are dropped
1689
- *
1690
- * @returns number
1691
- */
1692
- ubit12be() {
1693
- return this.bit(12, true, "big");
1694
- }
1695
- /**
1696
- * Bit field reader
1697
- *
1698
- * Note: When returning to a byte read, remaining bits are dropped
1699
- *
1700
- * @param {boolean} unsigned - if the value is unsigned
1701
- * @returns number
1702
- */
1703
- bit13(unsigned) {
1704
- return this.bit(13, unsigned);
1705
- }
1706
- /**
1707
- * Bit field reader
1708
- *
1709
- * Note: When returning to a byte read, remaining bits are dropped
1710
- *
1711
- * @param {boolean} unsigned - if the value is unsigned
1712
- * @returns number
1713
- */
1714
- bit13le(unsigned) {
1715
- return this.bit(13, unsigned, "little");
1716
- }
1717
- /**
1718
- * Bit field reader
1719
- *
1720
- * Note: When returning to a byte read, remaining bits are dropped
1721
- *
1722
- * @param {boolean} unsigned - if the value is unsigned
1723
- * @returns number
1724
- */
1725
- bit13be(unsigned) {
1726
- return this.bit(13, unsigned, "big");
1727
- }
1728
- /**
1729
- * Bit field reader
1730
- *
1731
- * Note: When returning to a byte read, remaining bits are dropped
1732
- *
1733
- * @returns number
1734
- */
1735
- ubit13() {
1736
- return this.bit(13, true);
1737
- }
1738
- /**
1739
- * Bit field reader
1740
- *
1741
- * Note: When returning to a byte read, remaining bits are dropped
1742
- *
1743
- * @returns number
1744
- */
1745
- ubit13le() {
1746
- return this.bit(13, true, "little");
1747
- }
1748
- /**
1749
- * Bit field reader
1750
- *
1751
- * Note: When returning to a byte read, remaining bits are dropped
1752
- *
1753
- * @returns number
1754
- */
1755
- ubit13be() {
1756
- return this.bit(13, true, "big");
1757
- }
1758
- /**
1759
- * Bit field reader
1760
- *
1761
- * Note: When returning to a byte read, remaining bits are dropped
1762
- *
1763
- * @param {boolean} unsigned - if the value is unsigned
1764
- * @returns number
1765
- */
1766
- bit14(unsigned) {
1767
- return this.bit(14, unsigned);
1768
- }
1769
- /**
1770
- * Bit field reader
1771
- *
1772
- * Note: When returning to a byte read, remaining bits are dropped
1773
- *
1774
- * @param {boolean} unsigned - if the value is unsigned
1775
- * @returns number
1776
- */
1777
- bit14le(unsigned) {
1778
- return this.bit(14, unsigned, "little");
1779
- }
1780
- /**
1781
- * Bit field reader
1782
- *
1783
- * Note: When returning to a byte read, remaining bits are dropped
1784
- *
1785
- * @param {boolean} unsigned - if the value is unsigned
1786
- * @returns number
1787
- */
1788
- bit14be(unsigned) {
1789
- return this.bit(14, unsigned, "big");
1790
- }
1791
- /**
1792
- * Bit field reader
1793
- *
1794
- * Note: When returning to a byte read, remaining bits are dropped
1795
- *
1796
- * @returns number
1797
- */
1798
- ubit14() {
1799
- return this.bit(14, true);
1800
- }
1801
- /**
1802
- * Bit field reader
1803
- *
1804
- * Note: When returning to a byte read, remaining bits are dropped
1805
- *
1806
- * @returns number
1807
- */
1808
- ubit14le() {
1809
- return this.bit(14, true, "little");
1810
- }
1811
- /**
1812
- * Bit field reader
1813
- *
1814
- * Note: When returning to a byte read, remaining bits are dropped
1815
- *
1816
- * @returns number
1817
- */
1818
- ubit14be() {
1819
- return this.bit(14, true, "big");
1820
- }
1821
- /**
1822
- * Bit field reader
1823
- *
1824
- * Note: When returning to a byte read, remaining bits are dropped
1825
- *
1826
- * @param {boolean} unsigned - if the value is unsigned
1827
- * @returns number
1828
- */
1829
- bit15(unsigned) {
1830
- return this.bit(15, unsigned);
1831
- }
1832
- /**
1833
- * Bit field reader
1834
- *
1835
- * Note: When returning to a byte read, remaining bits are dropped
1836
- *
1837
- * @param {boolean} unsigned - if the value is unsigned
1838
- * @returns number
1839
- */
1840
- bit15le(unsigned) {
1841
- return this.bit(15, unsigned, "little");
1842
- }
1843
- /**
1844
- * Bit field reader
1845
- *
1846
- * Note: When returning to a byte read, remaining bits are dropped
1847
- *
1848
- * @param {boolean} unsigned - if the value is unsigned
1849
- * @returns number
1850
- */
1851
- bit15be(unsigned) {
1852
- return this.bit(15, unsigned, "big");
1853
- }
1854
- /**
1855
- * Bit field reader
1856
- *
1857
- * Note: When returning to a byte read, remaining bits are dropped
1858
- *
1859
- * @returns number
1860
- */
1861
- ubit15() {
1862
- return this.bit(15, true);
1863
- }
1864
- /**
1865
- * Bit field reader
1866
- *
1867
- * Note: When returning to a byte read, remaining bits are dropped
1868
- *
1869
- * @returns number
1870
- */
1871
- ubit15le() {
1872
- return this.bit(15, true, "little");
1873
- }
1874
- /**
1875
- * Bit field reader
1876
- *
1877
- * Note: When returning to a byte read, remaining bits are dropped
1878
- *
1879
- * @returns number
1880
- */
1881
- ubit15be() {
1882
- return this.bit(15, true, "big");
1883
- }
1884
- /**
1885
- * Bit field reader
1886
- *
1887
- * Note: When returning to a byte read, remaining bits are dropped
1888
- *
1889
- * @param {boolean} unsigned - if the value is unsigned
1890
- * @returns number
1891
- */
1892
- bit16(unsigned) {
1893
- return this.bit(16, unsigned);
1894
- }
1895
- /**
1896
- * Bit field reader
1897
- *
1898
- * Note: When returning to a byte read, remaining bits are dropped
1899
- *
1900
- * @param {boolean} unsigned - if the value is unsigned
1901
- * @returns number
1902
- */
1903
- bit16le(unsigned) {
1904
- return this.bit(16, unsigned, "little");
1905
- }
1906
- /**
1907
- * Bit field reader
1908
- *
1909
- * Note: When returning to a byte read, remaining bits are dropped
1910
- *
1911
- * @param {boolean} unsigned - if the value is unsigned
1912
- * @returns number
1913
- */
1914
- bit16be(unsigned) {
1915
- return this.bit(16, unsigned, "big");
1916
- }
1917
- /**
1918
- * Bit field reader
1919
- *
1920
- * Note: When returning to a byte read, remaining bits are dropped
1921
- *
1922
- * @returns number
1923
- */
1924
- ubit16() {
1925
- return this.bit(16, true);
1926
- }
1927
- /**
1928
- * Bit field reader
1929
- *
1930
- * Note: When returning to a byte read, remaining bits are dropped
1931
- *
1932
- * @returns number
1933
- */
1934
- ubit16le() {
1935
- return this.bit(16, true, "little");
1936
- }
1937
- /**
1938
- * Bit field reader
1939
- *
1940
- * Note: When returning to a byte read, remaining bits are dropped
1941
- *
1942
- * @returns number
1943
- */
1944
- ubit16be() {
1945
- return this.bit(16, true, "big");
1946
- }
1947
- /**
1948
- * Bit field reader
1949
- *
1950
- * Note: When returning to a byte read, remaining bits are dropped
1951
- *
1952
- * @param {boolean} unsigned - if the value is unsigned
1953
- * @returns number
1954
- */
1955
- bit17(unsigned) {
1956
- return this.bit(17, unsigned);
1957
- }
1958
- /**
1959
- * Bit field reader
1960
- *
1961
- * Note: When returning to a byte read, remaining bits are dropped
1962
- *
1963
- * @param {boolean} unsigned - if the value is unsigned
1964
- * @returns number
1965
- */
1966
- bit17le(unsigned) {
1967
- return this.bit(17, unsigned, "little");
1968
- }
1969
- /**
1970
- * Bit field reader
1971
- *
1972
- * Note: When returning to a byte read, remaining bits are dropped
1973
- *
1974
- * @param {boolean} unsigned - if the value is unsigned
1975
- * @returns number
1976
- */
1977
- bit17be(unsigned) {
1978
- return this.bit(17, unsigned, "big");
1979
- }
1980
- /**
1981
- * Bit field reader
1982
- *
1983
- * Note: When returning to a byte read, remaining bits are dropped
1984
- *
1985
- * @returns number
1986
- */
1987
- ubit17() {
1988
- return this.bit(17, true);
1989
- }
1990
- /**
1991
- * Bit field reader
1992
- *
1993
- * Note: When returning to a byte read, remaining bits are dropped
1994
- *
1995
- * @returns number
1996
- */
1997
- ubit17le() {
1998
- return this.bit(17, true, "little");
1999
- }
2000
- /**
2001
- * Bit field reader
2002
- *
2003
- * Note: When returning to a byte read, remaining bits are dropped
2004
- *
2005
- * @returns number
2006
- */
2007
- ubit17be() {
2008
- return this.bit(17, true, "big");
2009
- }
2010
- /**
2011
- * Bit field reader
2012
- *
2013
- * Note: When returning to a byte read, remaining bits are dropped
2014
- *
2015
- * @param {boolean} unsigned - if the value is unsigned
2016
- * @returns number
2017
- */
2018
- bit18(unsigned) {
2019
- return this.bit(18, unsigned);
2020
- }
2021
- /**
2022
- * Bit field reader
2023
- *
2024
- * Note: When returning to a byte read, remaining bits are dropped
2025
- *
2026
- * @param {boolean} unsigned - if the value is unsigned
2027
- * @returns number
2028
- */
2029
- bit18le(unsigned) {
2030
- return this.bit(18, unsigned, "little");
2031
- }
2032
- /**
2033
- * Bit field reader
2034
- *
2035
- * Note: When returning to a byte read, remaining bits are dropped
2036
- *
2037
- * @param {boolean} unsigned - if the value is unsigned
2038
- * @returns number
2039
- */
2040
- bit18be(unsigned) {
2041
- return this.bit(18, unsigned, "big");
2042
- }
2043
- /**
2044
- * Bit field reader
2045
- *
2046
- * Note: When returning to a byte read, remaining bits are dropped
2047
- *
2048
- * @returns number
2049
- */
2050
- ubit18() {
2051
- return this.bit(18, true);
2052
- }
2053
- /**
2054
- * Bit field reader
2055
- *
2056
- * Note: When returning to a byte read, remaining bits are dropped
2057
- *
2058
- * @returns number
2059
- */
2060
- ubit18le() {
2061
- return this.bit(18, true, "little");
2062
- }
2063
- /**
2064
- * Bit field reader
2065
- *
2066
- * Note: When returning to a byte read, remaining bits are dropped
2067
- *
2068
- * @returns number
2069
- */
2070
- ubit18be() {
2071
- return this.bit(18, true, "big");
2072
- }
2073
- /**
2074
- * Bit field reader
2075
- *
2076
- * Note: When returning to a byte read, remaining bits are dropped
2077
- *
2078
- * @param {boolean} unsigned - if the value is unsigned
2079
- * @returns number
2080
- */
2081
- bit19(unsigned) {
2082
- return this.bit(19, unsigned);
2083
- }
2084
- /**
2085
- * Bit field reader
2086
- *
2087
- * Note: When returning to a byte read, remaining bits are dropped
2088
- *
2089
- * @param {boolean} unsigned - if the value is unsigned
2090
- * @returns number
2091
- */
2092
- bit19le(unsigned) {
2093
- return this.bit(19, unsigned, "little");
2094
- }
2095
- /**
2096
- * Bit field reader
2097
- *
2098
- * Note: When returning to a byte read, remaining bits are dropped
2099
- *
2100
- * @param {boolean} unsigned - if the value is unsigned
2101
- * @returns number
2102
- */
2103
- bit19be(unsigned) {
2104
- return this.bit(19, unsigned, "big");
2105
- }
2106
- /**
2107
- * Bit field reader
2108
- *
2109
- * Note: When returning to a byte read, remaining bits are dropped
2110
- *
2111
- * @returns number
2112
- */
2113
- ubit19() {
2114
- return this.bit(19, true);
2115
- }
2116
- /**
2117
- * Bit field reader
2118
- *
2119
- * Note: When returning to a byte read, remaining bits are dropped
2120
- *
2121
- * @returns number
2122
- */
2123
- ubit19le() {
2124
- return this.bit(19, true, "little");
2125
- }
2126
- /**
2127
- * Bit field reader
2128
- *
2129
- * Note: When returning to a byte read, remaining bits are dropped
2130
- *
2131
- * @returns number
2132
- */
2133
- ubit19be() {
2134
- return this.bit(19, true, "big");
2135
- }
2136
- /**
2137
- * Bit field reader
2138
- *
2139
- * Note: When returning to a byte read, remaining bits are dropped
2140
- *
2141
- * @param {boolean} unsigned - if the value is unsigned
2142
- * @returns number
2143
- */
2144
- bit20(unsigned) {
2145
- return this.bit(20, unsigned);
2146
- }
2147
- /**
2148
- * Bit field reader
2149
- *
2150
- * Note: When returning to a byte read, remaining bits are dropped
2151
- *
2152
- * @param {boolean} unsigned - if the value is unsigned
2153
- * @returns number
2154
- */
2155
- bit20le(unsigned) {
2156
- return this.bit(20, unsigned, "little");
2157
- }
2158
- /**
2159
- * Bit field reader
2160
- *
2161
- * Note: When returning to a byte read, remaining bits are dropped
2162
- *
2163
- * @param {boolean} unsigned - if the value is unsigned
2164
- * @returns number
2165
- */
2166
- bit20be(unsigned) {
2167
- return this.bit(20, unsigned, "big");
2168
- }
2169
- /**
2170
- * Bit field reader
2171
- *
2172
- * Note: When returning to a byte read, remaining bits are dropped
2173
- *
2174
- * @returns number
2175
- */
2176
- ubit20() {
2177
- return this.bit(20, true);
2178
- }
2179
- /**
2180
- * Bit field reader
2181
- *
2182
- * Note: When returning to a byte read, remaining bits are dropped
2183
- *
2184
- * @returns number
2185
- */
2186
- ubit20le() {
2187
- return this.bit(20, true, "little");
2188
- }
2189
- /**
2190
- * Bit field reader
2191
- *
2192
- * Note: When returning to a byte read, remaining bits are dropped
2193
- *
2194
- * @returns number
2195
- */
2196
- ubit20be() {
2197
- return this.bit(20, true, "big");
2198
- }
2199
- /**
2200
- * Bit field reader
2201
- *
2202
- * Note: When returning to a byte read, remaining bits are dropped
2203
- *
2204
- * @param {boolean} unsigned - if the value is unsigned
2205
- * @returns number
2206
- */
2207
- bit21(unsigned) {
2208
- return this.bit(21, unsigned);
2209
- }
2210
- /**
2211
- * Bit field reader
2212
- *
2213
- * Note: When returning to a byte read, remaining bits are dropped
2214
- *
2215
- * @param {boolean} unsigned - if the value is unsigned
2216
- * @returns number
2217
- */
2218
- bit21le(unsigned) {
2219
- return this.bit(21, unsigned, "little");
2220
- }
2221
- /**
2222
- * Bit field reader
2223
- *
2224
- * Note: When returning to a byte read, remaining bits are dropped
2225
- *
2226
- * @param {boolean} unsigned - if the value is unsigned
2227
- * @returns number
2228
- */
2229
- bit21be(unsigned) {
2230
- return this.bit(21, unsigned, "big");
2231
- }
2232
- /**
2233
- * Bit field reader
2234
- *
2235
- * Note: When returning to a byte read, remaining bits are dropped
2236
- *
2237
- * @returns number
2238
- */
2239
- ubit21() {
2240
- return this.bit(21, true);
2241
- }
2242
- /**
2243
- * Bit field reader
2244
- *
2245
- * Note: When returning to a byte read, remaining bits are dropped
2246
- *
2247
- * @returns number
2248
- */
2249
- ubit21le() {
2250
- return this.bit(21, true, "little");
2251
- }
2252
- /**
2253
- * Bit field reader
2254
- *
2255
- * Note: When returning to a byte read, remaining bits are dropped
2256
- *
2257
- * @returns number
2258
- */
2259
- ubit21be() {
2260
- return this.bit(21, true, "big");
2261
- }
2262
- /**
2263
- * Bit field reader
2264
- *
2265
- * Note: When returning to a byte read, remaining bits are dropped
2266
- *
2267
- * @param {boolean} unsigned - if the value is unsigned
2268
- * @returns number
2269
- */
2270
- bit22(unsigned) {
2271
- return this.bit(22, unsigned);
2272
- }
2273
- /**
2274
- * Bit field reader
2275
- *
2276
- * Note: When returning to a byte read, remaining bits are dropped
2277
- *
2278
- * @param {boolean} unsigned - if the value is unsigned
2279
- * @returns number
2280
- */
2281
- bit22le(unsigned) {
2282
- return this.bit(22, unsigned, "little");
2283
- }
2284
- /**
2285
- * Bit field reader
2286
- *
2287
- * Note: When returning to a byte read, remaining bits are dropped
2288
- *
2289
- * @param {boolean} unsigned - if the value is unsigned
2290
- * @returns number
2291
- */
2292
- bit22be(unsigned) {
2293
- return this.bit(22, unsigned, "big");
2294
- }
2295
- /**
2296
- * Bit field reader
2297
- *
2298
- * Note: When returning to a byte read, remaining bits are dropped
2299
- *
2300
- * @returns number
2301
- */
2302
- ubit22() {
2303
- return this.bit(22, true);
2304
- }
2305
- /**
2306
- * Bit field reader
2307
- *
2308
- * Note: When returning to a byte read, remaining bits are dropped
2309
- *
2310
- * @returns number
2311
- */
2312
- ubit22le() {
2313
- return this.bit(22, true, "little");
2314
- }
2315
- /**
2316
- * Bit field reader
2317
- *
2318
- * Note: When returning to a byte read, remaining bits are dropped
2319
- *
2320
- * @returns number
2321
- */
2322
- ubit22be() {
2323
- return this.bit(22, true, "big");
2324
- }
2325
- /**
2326
- * Bit field reader
2327
- *
2328
- * Note: When returning to a byte read, remaining bits are dropped
2329
- *
2330
- * @param {boolean} unsigned - if the value is unsigned
2331
- * @returns number
2332
- */
2333
- bit23(unsigned) {
2334
- return this.bit(23, unsigned);
2335
- }
2336
- /**
2337
- * Bit field reader
2338
- *
2339
- * Note: When returning to a byte read, remaining bits are dropped
2340
- *
2341
- * @param {boolean} unsigned - if the value is unsigned
2342
- * @returns number
2343
- */
2344
- bit23le(unsigned) {
2345
- return this.bit(23, unsigned, "little");
2346
- }
2347
- /**
2348
- * Bit field reader
2349
- *
2350
- * Note: When returning to a byte read, remaining bits are dropped
2351
- *
2352
- * @param {boolean} unsigned - if the value is unsigned
2353
- * @returns number
2354
- */
2355
- bit23be(unsigned) {
2356
- return this.bit(23, unsigned, "big");
2357
- }
2358
- /**
2359
- * Bit field reader
2360
- *
2361
- * Note: When returning to a byte read, remaining bits are dropped
2362
- *
2363
- * @returns number
2364
- */
2365
- ubit23() {
2366
- return this.bit(23, true);
2367
- }
2368
- /**
2369
- * Bit field reader
2370
- *
2371
- * Note: When returning to a byte read, remaining bits are dropped
2372
- *
2373
- * @returns number
2374
- */
2375
- ubit23le() {
2376
- return this.bit(23, true, "little");
2377
- }
2378
- /**
2379
- * Bit field reader
2380
- *
2381
- * Note: When returning to a byte read, remaining bits are dropped
2382
- *
2383
- * @returns number
2384
- */
2385
- ubit23be() {
2386
- return this.bit(23, true, "big");
2387
- }
2388
- /**
2389
- * Bit field reader
2390
- *
2391
- * Note: When returning to a byte read, remaining bits are dropped
2392
- *
2393
- * @param {boolean} unsigned - if the value is unsigned
2394
- * @returns number
2395
- */
2396
- bit24(unsigned) {
2397
- return this.bit(24, unsigned);
2398
- }
2399
- /**
2400
- * Bit field reader
2401
- *
2402
- * Note: When returning to a byte read, remaining bits are dropped
2403
- *
2404
- * @param {boolean} unsigned - if the value is unsigned
2405
- * @returns number
2406
- */
2407
- bit24le(unsigned) {
2408
- return this.bit(24, unsigned, "little");
2409
- }
2410
- /**
2411
- * Bit field reader
2412
- *
2413
- * Note: When returning to a byte read, remaining bits are dropped
2414
- *
2415
- * @param {boolean} unsigned - if the value is unsigned
2416
- * @returns number
2417
- */
2418
- bit24be(unsigned) {
2419
- return this.bit(24, unsigned, "big");
2420
- }
2421
- /**
2422
- * Bit field reader
2423
- *
2424
- * Note: When returning to a byte read, remaining bits are dropped
2425
- *
2426
- * @returns number
2427
- */
2428
- ubit24() {
2429
- return this.bit(24, true);
2430
- }
2431
- /**
2432
- * Bit field reader
2433
- *
2434
- * Note: When returning to a byte read, remaining bits are dropped
2435
- *
2436
- * @returns number
2437
- */
2438
- ubit24le() {
2439
- return this.bit(24, true, "little");
2440
- }
2441
- /**
2442
- * Bit field reader
2443
- *
2444
- * Note: When returning to a byte read, remaining bits are dropped
2445
- *
2446
- * @returns number
2447
- */
2448
- ubit24be() {
2449
- return this.bit(24, true, "big");
2450
- }
2451
- /**
2452
- * Bit field reader
2453
- *
2454
- * Note: When returning to a byte read, remaining bits are dropped
2455
- *
2456
- * @param {boolean} unsigned - if the value is unsigned
2457
- * @returns number
2458
- */
2459
- bit25(unsigned) {
2460
- return this.bit(25, unsigned);
2461
- }
2462
- /**
2463
- * Bit field reader
2464
- *
2465
- * Note: When returning to a byte read, remaining bits are dropped
2466
- *
2467
- * @param {boolean} unsigned - if the value is unsigned
2468
- * @returns number
2469
- */
2470
- bit25le(unsigned) {
2471
- return this.bit(25, unsigned, "little");
2472
- }
2473
- /**
2474
- * Bit field reader
2475
- *
2476
- * Note: When returning to a byte read, remaining bits are dropped
2477
- *
2478
- * @param {boolean} unsigned - if the value is unsigned
2479
- * @returns number
2480
- */
2481
- bit25be(unsigned) {
2482
- return this.bit(25, unsigned, "big");
2483
- }
2484
- /**
2485
- * Bit field reader
2486
- *
2487
- * Note: When returning to a byte read, remaining bits are dropped
2488
- *
2489
- * @returns number
2490
- */
2491
- ubit25() {
2492
- return this.bit(25, true);
2493
- }
2494
- /**
2495
- * Bit field reader
2496
- *
2497
- * Note: When returning to a byte read, remaining bits are dropped
2498
- *
2499
- * @returns number
2500
- */
2501
- ubit25le() {
2502
- return this.bit(25, true, "little");
2503
- }
2504
- /**
2505
- * Bit field reader
2506
- *
2507
- * Note: When returning to a byte read, remaining bits are dropped
2508
- *
2509
- * @returns number
2510
- */
2511
- ubit25be() {
2512
- return this.bit(25, true, "big");
2513
- }
2514
- /**
2515
- * Bit field reader
2516
- *
2517
- * Note: When returning to a byte read, remaining bits are dropped
2518
- *
2519
- * @param {boolean} unsigned - if the value is unsigned
2520
- * @returns number
2521
- */
2522
- bit26(unsigned) {
2523
- return this.bit(26, unsigned);
2524
- }
2525
- /**
2526
- * Bit field reader
2527
- *
2528
- * Note: When returning to a byte read, remaining bits are dropped
2529
- *
2530
- * @param {boolean} unsigned - if the value is unsigned
2531
- * @returns number
2532
- */
2533
- bit26le(unsigned) {
2534
- return this.bit(26, unsigned, "little");
2535
- }
2536
- /**
2537
- * Bit field reader
2538
- *
2539
- * Note: When returning to a byte read, remaining bits are dropped
2540
- *
2541
- * @param {boolean} unsigned - if the value is unsigned
2542
- * @returns number
2543
- */
2544
- bit26be(unsigned) {
2545
- return this.bit(26, unsigned, "big");
2546
- }
2547
- /**
2548
- * Bit field reader
2549
- *
2550
- * Note: When returning to a byte read, remaining bits are dropped
2551
- *
2552
- * @returns number
2553
- */
2554
- ubit26() {
2555
- return this.bit(26, true);
2556
- }
2557
- /**
2558
- * Bit field reader
2559
- *
2560
- * Note: When returning to a byte read, remaining bits are dropped
2561
- *
2562
- * @returns number
2563
- */
2564
- ubit26le() {
2565
- return this.bit(26, true, "little");
2566
- }
2567
- /**
2568
- * Bit field reader
2569
- *
2570
- * Note: When returning to a byte read, remaining bits are dropped
2571
- *
2572
- * @returns number
2573
- */
2574
- ubit26be() {
2575
- return this.bit(26, true, "big");
2576
- }
2577
- /**
2578
- * Bit field reader
2579
- *
2580
- * Note: When returning to a byte read, remaining bits are dropped
2581
- *
2582
- * @param {boolean} unsigned - if the value is unsigned
2583
- * @returns number
2584
- */
2585
- bit27(unsigned) {
2586
- return this.bit(27, unsigned);
2587
- }
2588
- /**
2589
- * Bit field reader
2590
- *
2591
- * Note: When returning to a byte read, remaining bits are dropped
2592
- *
2593
- * @param {boolean} unsigned - if the value is unsigned
2594
- * @returns number
2595
- */
2596
- bit27le(unsigned) {
2597
- return this.bit(27, unsigned, "little");
2598
- }
2599
- /**
2600
- * Bit field reader
2601
- *
2602
- * Note: When returning to a byte read, remaining bits are dropped
2603
- *
2604
- * @param {boolean} unsigned - if the value is unsigned
2605
- * @returns number
2606
- */
2607
- bit27be(unsigned) {
2608
- return this.bit(27, unsigned, "big");
2609
- }
2610
- /**
2611
- * Bit field reader
2612
- *
2613
- * Note: When returning to a byte read, remaining bits are dropped
2614
- *
2615
- * @returns number
2616
- */
2617
- ubit27() {
2618
- return this.bit(27, true);
2619
- }
2620
- /**
2621
- * Bit field reader
2622
- *
2623
- * Note: When returning to a byte read, remaining bits are dropped
2624
- *
2625
- * @returns number
2626
- */
2627
- ubit27le() {
2628
- return this.bit(27, true, "little");
2629
- }
2630
- /**
2631
- * Bit field reader
2632
- *
2633
- * Note: When returning to a byte read, remaining bits are dropped
2634
- *
2635
- * @returns number
2636
- */
2637
- ubit27be() {
2638
- return this.bit(27, true, "big");
2639
- }
2640
- /**
2641
- * Bit field reader
2642
- *
2643
- * Note: When returning to a byte read, remaining bits are dropped
2644
- *
2645
- * @param {boolean} unsigned - if the value is unsigned
2646
- * @returns number
2647
- */
2648
- bit28(unsigned) {
2649
- return this.bit(28, unsigned);
2650
- }
2651
- /**
2652
- * Bit field reader
2653
- *
2654
- * Note: When returning to a byte read, remaining bits are dropped
2655
- *
2656
- * @param {boolean} unsigned - if the value is unsigned
2657
- * @returns number
2658
- */
2659
- bit28le(unsigned) {
2660
- return this.bit(28, unsigned, "little");
2661
- }
2662
- /**
2663
- * Bit field reader
2664
- *
2665
- * Note: When returning to a byte read, remaining bits are dropped
2666
- *
2667
- * @param {boolean} unsigned - if the value is unsigned
2668
- * @returns number
2669
- */
2670
- bit28be(unsigned) {
2671
- return this.bit(28, unsigned, "big");
2672
- }
2673
- /**
2674
- * Bit field reader
2675
- *
2676
- * Note: When returning to a byte read, remaining bits are dropped
2677
- *
2678
- * @returns number
2679
- */
2680
- ubit28() {
2681
- return this.bit(28, true);
2682
- }
2683
- /**
2684
- * Bit field reader
2685
- *
2686
- * Note: When returning to a byte read, remaining bits are dropped
2687
- *
2688
- * @returns number
2689
- */
2690
- ubit28le() {
2691
- return this.bit(28, true, "little");
2692
- }
2693
- /**
2694
- * Bit field reader
2695
- *
2696
- * Note: When returning to a byte read, remaining bits are dropped
2697
- *
2698
- * @returns number
2699
- */
2700
- ubit28be() {
2701
- return this.bit(28, true, "big");
2702
- }
2703
- /**
2704
- * Bit field reader
2705
- *
2706
- * Note: When returning to a byte read, remaining bits are dropped
2707
- *
2708
- * @param {boolean} unsigned - if the value is unsigned
2709
- * @returns number
2710
- */
2711
- bit29(unsigned) {
2712
- return this.bit(29, unsigned);
2713
- }
2714
- /**
2715
- * Bit field reader
2716
- *
2717
- * Note: When returning to a byte read, remaining bits are dropped
2718
- *
2719
- * @param {boolean} unsigned - if the value is unsigned
2720
- * @returns number
2721
- */
2722
- bit29le(unsigned) {
2723
- return this.bit(29, unsigned, "little");
2724
- }
2725
- /**
2726
- * Bit field reader
2727
- *
2728
- * Note: When returning to a byte read, remaining bits are dropped
2729
- *
2730
- * @param {boolean} unsigned - if the value is unsigned
2731
- * @returns number
2732
- */
2733
- bit29be(unsigned) {
2734
- return this.bit(29, unsigned, "big");
2735
- }
2736
- /**
2737
- * Bit field reader
2738
- *
2739
- * Note: When returning to a byte read, remaining bits are dropped
2740
- *
2741
- * @returns number
2742
- */
2743
- ubit29() {
2744
- return this.bit(29, true);
2745
- }
2746
- /**
2747
- * Bit field reader
2748
- *
2749
- * Note: When returning to a byte read, remaining bits are dropped
2750
- *
2751
- * @returns number
2752
- */
2753
- ubit29le() {
2754
- return this.bit(29, true, "little");
2755
- }
2756
- /**
2757
- * Bit field reader
2758
- *
2759
- * Note: When returning to a byte read, remaining bits are dropped
2760
- *
2761
- * @returns number
2762
- */
2763
- ubit29be() {
2764
- return this.bit(29, true, "big");
2765
- }
2766
- /**
2767
- * Bit field reader
2768
- *
2769
- * Note: When returning to a byte read, remaining bits are dropped
2770
- *
2771
- * @param {boolean} unsigned - if the value is unsigned
2772
- * @returns number
2773
- */
2774
- bit30(unsigned) {
2775
- return this.bit(30, unsigned);
2776
- }
2777
- /**
2778
- * Bit field reader
2779
- *
2780
- * Note: When returning to a byte read, remaining bits are dropped
2781
- *
2782
- * @param {boolean} unsigned - if the value is unsigned
2783
- * @returns number
2784
- */
2785
- bit30le(unsigned) {
2786
- return this.bit(30, unsigned, "little");
2787
- }
2788
- /**
2789
- * Bit field reader
2790
- *
2791
- * Note: When returning to a byte read, remaining bits are dropped
2792
- *
2793
- * @param {boolean} unsigned - if the value is unsigned
2794
- * @returns number
2795
- */
2796
- bit30be(unsigned) {
2797
- return this.bit(30, unsigned, "big");
2798
- }
2799
- /**
2800
- * Bit field reader
2801
- *
2802
- * Note: When returning to a byte read, remaining bits are dropped
2803
- *
2804
- * @returns number
2805
- */
2806
- ubit30() {
2807
- return this.bit(30, true);
2808
- }
2809
- /**
2810
- * Bit field reader
2811
- *
2812
- * Note: When returning to a byte read, remaining bits are dropped
2813
- *
2814
- * @returns number
2815
- */
2816
- ubit30le() {
2817
- return this.bit(30, true, "little");
2818
- }
2819
- /**
2820
- * Bit field reader
2821
- *
2822
- * Note: When returning to a byte read, remaining bits are dropped
2823
- *
2824
- * @returns number
2825
- */
2826
- ubit30be() {
2827
- return this.bit(30, true, "big");
2828
- }
2829
- /**
2830
- * Bit field reader
2831
- *
2832
- * Note: When returning to a byte read, remaining bits are dropped
2833
- *
2834
- * @param {boolean} unsigned - if the value is unsigned
2835
- * @returns number
2836
- */
2837
- bit31(unsigned) {
2838
- return this.bit(31, unsigned);
2839
- }
2840
- /**
2841
- * Bit field reader
2842
- *
2843
- * Note: When returning to a byte read, remaining bits are dropped
2844
- *
2845
- * @param {boolean} unsigned - if the value is unsigned
2846
- * @returns number
2847
- */
2848
- bit31le(unsigned) {
2849
- return this.bit(31, unsigned, "little");
2850
- }
2851
- /**
2852
- * Bit field reader
2853
- *
2854
- * Note: When returning to a byte read, remaining bits are dropped
2855
- *
2856
- * @param {boolean} unsigned - if the value is unsigned
2857
- * @returns number
2858
- */
2859
- bit31be(unsigned) {
2860
- return this.bit(31, unsigned, "big");
2861
- }
2862
- /**
2863
- * Bit field reader
2864
- *
2865
- * Note: When returning to a byte read, remaining bits are dropped
2866
- *
2867
- * @returns number
2868
- */
2869
- ubit31() {
2870
- return this.bit(31, true);
2871
- }
2872
- /**
2873
- * Bit field reader
2874
- *
2875
- * Note: When returning to a byte read, remaining bits are dropped
2876
- *
2877
- * @returns number
2878
- */
2879
- ubit31le() {
2880
- return this.bit(31, true, "little");
2881
- }
2882
- /**
2883
- * Bit field reader
2884
- *
2885
- * Note: When returning to a byte read, remaining bits are dropped
2886
- *
2887
- * @returns number
2888
- */
2889
- ubit31be() {
2890
- return this.bit(31, true, "big");
2891
- }
2892
- /**
2893
- * Bit field reader
2894
- *
2895
- * Note: When returning to a byte read, remaining bits are dropped
2896
- *
2897
- * @param {boolean} unsigned - if the value is unsigned
2898
- * @returns number
2899
- */
2900
- bit32(unsigned) {
2901
- return this.bit(32, unsigned);
2902
- }
2903
- /**
2904
- * Bit field reader
2905
- *
2906
- * Note: When returning to a byte read, remaining bits are dropped
2907
- *
2908
- * @param {boolean} unsigned - if the value is unsigned
2909
- * @returns number
2910
- */
2911
- bit32le(unsigned) {
2912
- return this.bit(32, unsigned, "little");
2913
- }
2914
- /**
2915
- * Bit field reader
2916
- *
2917
- * Note: When returning to a byte read, remaining bits are dropped
2918
- *
2919
- * @param {boolean} unsigned - if the value is unsigned
2920
- * @returns number
2921
- */
2922
- bit32be(unsigned) {
2923
- return this.bit(32, unsigned, "big");
2924
- }
2925
- /**
2926
- * Bit field reader
2927
- *
2928
- * Note: When returning to a byte read, remaining bits are dropped
2929
- *
2930
- * @returns number
2931
- */
2932
- ubit32() {
2933
- return this.bit(32, true);
2934
- }
2935
- /**
2936
- * Bit field reader
2937
- *
2938
- * Note: When returning to a byte read, remaining bits are dropped
2939
- *
2940
- * @returns number
2941
- */
2942
- ubit32le() {
2943
- return this.bit(32, true, "little");
2944
- }
2945
- /**
2946
- * Bit field reader
2947
- *
2948
- * Note: When returning to a byte read, remaining bits are dropped
2949
- *
2950
- * @returns number
2951
- */
2952
- ubit32be() {
2953
- return this.bit(32, true, "big");
2954
- }
2955
- /**
2956
- * Bit field reader
2957
- *
2958
- * Note: When returning to a byte read, remaining bits are dropped
2959
- *
2960
- * @param {number} bits - bits to read
2961
- * @returns number
2962
- */
2963
- readUBitBE(bits) {
2964
- return this.bit(bits, true, "big");
2965
- }
2966
- /**
2967
- * Bit field reader
2968
- *
2969
- * Note: When returning to a byte read, remaining bits are dropped
2970
- *
2971
- * @param {number} bits - bits to read
2972
- * @returns number
2973
- */
2974
- ubitbe(bits) {
2975
- return this.bit(bits, true, "big");
2976
- }
2977
- /**
2978
- * Bit field reader
2979
- *
2980
- * Note: When returning to a byte read, remaining bits are dropped
2981
- *
2982
- * @param {number} bits - bits to read
2983
- * @param {boolean} unsigned - if the value is unsigned
2984
- * @returns number
2985
- */
2986
- readBitBE(bits, unsigned) {
2987
- return this.bit(bits, unsigned, "big");
2988
- }
2989
- /**
2990
- * Bit field reader
2991
- *
2992
- * Note: When returning to a byte read, remaining bits are dropped
2993
- *
2994
- * @param {number} bits - bits to read
2995
- * @param {boolean} unsigned - if the value is unsigned
2996
- * @returns number
2997
- */
2998
- bitbe(bits, unsigned) {
2999
- return this.bit(bits, unsigned, "big");
3000
- }
3001
- /**
3002
- * Bit field reader
3003
- *
3004
- * Note: When returning to a byte read, remaining bits are dropped
3005
- *
3006
- * @param {number} bits - bits to read
3007
- * @returns number
3008
- */
3009
- readUBitLE(bits) {
3010
- return this.bit(bits, true, "little");
3011
- }
3012
- /**
3013
- * Bit field reader
3014
- *
3015
- * Note: When returning to a byte read, remaining bits are dropped
3016
- *
3017
- * @param {number} bits - bits to read
3018
- * @returns number
3019
- */
3020
- ubitle(bits) {
3021
- return this.bit(bits, true, "little");
3022
- }
3023
- /**
3024
- * Bit field reader
3025
- *
3026
- * Note: When returning to a byte read, remaining bits are dropped
3027
- *
3028
- * @param {number} bits - bits to read
3029
- * @param {boolean} unsigned - if the value is unsigned
3030
- * @returns number
3031
- */
3032
- readBitLE(bits, unsigned) {
3033
- return this.bit(bits, unsigned, "little");
3034
- }
3035
- /**
3036
- * Bit field reader
3037
- *
3038
- * Note: When returning to a byte read, remaining bits are dropped
3039
- *
3040
- * @param {number} bits - bits to read
3041
- * @param {boolean} unsigned - if the value is unsigned
3042
- * @returns number
3043
- */
3044
- bitle(bits, unsigned) {
3045
- return this.bit(bits, unsigned, "little");
3046
- }
3047
- //
3048
- //byte read
3049
- //
3050
- /**
3051
- * Read byte
3052
- *
3053
- * @param {boolean} unsigned - if value is unsigned or not
3054
- * @returns number
3055
- */
3056
- readByte(unsigned) {
3057
- return (0, common_js_1.rbyte)(this, unsigned);
3058
- }
3059
- /**
3060
- * Write byte
3061
- *
3062
- * @param {number} value - value as int
3063
- * @param {boolean} unsigned - if the value is unsigned
3064
- */
3065
- writeByte(value, unsigned) {
3066
- return (0, common_js_1.wbyte)(this, value, unsigned);
3067
- }
3068
- /**
3069
- * Read byte
3070
- *
3071
- * @param {boolean} unsigned - if value is unsigned or not
3072
- * @returns number
3073
- */
3074
- byte(unsigned) {
3075
- return this.readByte(unsigned);
3076
- }
3077
- /**
3078
- * Read byte
3079
- *
3080
- * @param {boolean} unsigned - if value is unsigned or not
3081
- * @returns number
3082
- */
3083
- int8(unsigned) {
3084
- return this.readByte(unsigned);
3085
- }
3086
- /**
3087
- * Read unsigned byte
3088
- *
3089
- * @returns number
3090
- */
3091
- readUByte() {
3092
- return this.readByte(true);
3093
- }
3094
- /**
3095
- * Read unsigned byte
3096
- *
3097
- * @returns number
3098
- */
3099
- uint8() {
3100
- return this.readByte(true);
3101
- }
3102
- /**
3103
- * Read unsigned byte
3104
- *
3105
- * @returns number
3106
- */
3107
- ubyte() {
3108
- return this.readByte(true);
3109
- }
3110
- //
3111
- //short16 read
3112
- //
3113
- /**
3114
- * Read short
3115
- *
3116
- * @param {boolean} unsigned - if value is unsigned or not
3117
- * @param {string} endian - ```big``` or ```little```
3118
- * @returns number
3119
- */
3120
- readInt16(unsigned, endian) {
3121
- return (0, common_js_1.rint16)(this, unsigned, endian);
3122
- }
3123
- /**
3124
- * Write int16
3125
- *
3126
- * @param {number} value - value as int
3127
- * @param {boolean} unsigned - if the value is unsigned
3128
- * @param {string} endian - ``big`` or ``little`
3129
- */
3130
- writeInt16(value, unsigned, endian) {
3131
- return (0, common_js_1.wint16)(this, value, unsigned, endian);
3132
- }
3133
- /**
3134
- * Read short
3135
- *
3136
- * @param {boolean} unsigned - if value is unsigned or not
3137
- * @param {string} endian - ```big``` or ```little```
3138
- * @returns number
3139
- */
3140
- int16(unsigned, endian) {
3141
- return this.readInt16(unsigned, endian);
3142
- }
3143
- /**
3144
- * Read short
3145
- *
3146
- * @param {boolean} unsigned - if value is unsigned or not
3147
- * @param {string} endian - ```big``` or ```little```
3148
- * @returns number
3149
- */
3150
- short(unsigned, endian) {
3151
- return this.readInt16(unsigned, endian);
3152
- }
3153
- /**
3154
- * Read short
3155
- *
3156
- * @param {boolean} unsigned - if value is unsigned or not
3157
- * @param {string} endian - ```big``` or ```little```
3158
- * @returns number
3159
- */
3160
- word(unsigned, endian) {
3161
- return this.readInt16(unsigned, endian);
3162
- }
3163
- /**
3164
- * Read unsigned short
3165
- *
3166
- * @param {string} endian - ```big``` or ```little```
3167
- *
3168
- * @returns number
3169
- */
3170
- readUInt16(endian) {
3171
- return this.readInt16(true, endian);
3172
- }
3173
- /**
3174
- * Read unsigned short
3175
- *
3176
- * @param {string} endian - ```big``` or ```little```
3177
- *
3178
- * @returns number
3179
- */
3180
- uint16(endian) {
3181
- return this.readInt16(true, endian);
3182
- }
3183
- /**
3184
- * Read unsigned short
3185
- *
3186
- * @param {string} endian - ```big``` or ```little```
3187
- *
3188
- * @returns number
3189
- */
3190
- ushort(endian) {
3191
- return this.readInt16(true, endian);
3192
- }
3193
- /**
3194
- * Read unsigned short
3195
- *
3196
- * @param {string} endian - ```big``` or ```little```
3197
- *
3198
- * @returns number
3199
- */
3200
- uword(endian) {
3201
- return this.readInt16(true, endian);
3202
- }
3203
- /**
3204
- * Read unsigned short in little endian
3205
- *
3206
- * @returns number
3207
- */
3208
- readUInt16LE() {
3209
- return this.readInt16(true, "little");
3210
- }
3211
- /**
3212
- * Read unsigned short in little endian
3213
- *
3214
- * @returns number
3215
- */
3216
- uint16le() {
3217
- return this.readInt16(true, "little");
3218
- }
3219
- /**
3220
- * Read unsigned short in little endian
3221
- *
3222
- * @returns number
3223
- */
3224
- ushortle() {
3225
- return this.readInt16(true, "little");
3226
- }
3227
- /**
3228
- * Read unsigned short in little endian
3229
- *
3230
- * @returns number
3231
- */
3232
- uwordle() {
3233
- return this.readInt16(true, "little");
3234
- }
3235
- /**
3236
- * Read signed short in little endian
3237
- *
3238
- * @returns number
3239
- */
3240
- readInt16LE() {
3241
- return this.readInt16(false, "little");
3242
- }
3243
- /**
3244
- * Read signed short in little endian
3245
- *
3246
- * @returns number
3247
- */
3248
- int16le() {
3249
- return this.readInt16(false, "little");
3250
- }
3251
- /**
3252
- * Read signed short in little endian
3253
- *
3254
- * @returns number
3255
- */
3256
- shortle() {
3257
- return this.readInt16(false, "little");
3258
- }
3259
- /**
3260
- * Read signed short in little endian
3261
- *
3262
- * @returns number
3263
- */
3264
- wordle() {
3265
- return this.readInt16(false, "little");
3266
- }
3267
- /**
3268
- * Read unsigned short in big endian
3269
- *
3270
- * @returns number
3271
- */
3272
- readUInt16BE() {
3273
- return this.readInt16(true, "big");
3274
- }
3275
- /**
3276
- * Read unsigned short in big endian
3277
- *
3278
- * @returns number
3279
- */
3280
- uint16be() {
3281
- return this.readInt16(true, "big");
3282
- }
3283
- /**
3284
- * Read unsigned short in big endian
3285
- *
3286
- * @returns number
3287
- */
3288
- ushortbe() {
3289
- return this.readInt16(true, "big");
3290
- }
3291
- /**
3292
- * Read unsigned short in big endian
3293
- *
3294
- * @returns number
3295
- */
3296
- uwordbe() {
3297
- return this.readInt16(true, "big");
3298
- }
3299
- /**
3300
- * Read signed short in big endian
3301
- *
3302
- * @returns number
3303
- */
3304
- readInt16BE() {
3305
- return this.readInt16(false, "big");
3306
- }
3307
- /**
3308
- * Read signed short in big endian
3309
- *
3310
- * @returns number
3311
- */
3312
- int16be() {
3313
- return this.readInt16(false, "big");
3314
- }
3315
- /**
3316
- * Read signed short in big endian
3317
- *
3318
- * @returns number
3319
- */
3320
- shortbe() {
3321
- return this.readInt16(false, "big");
3322
- }
3323
- /**
3324
- * Read signed short in big endian
3325
- *
3326
- * @returns number
3327
- */
3328
- wordbe() {
3329
- return this.readInt16(false, "big");
3330
- }
3331
- //
3332
- //half float read
3333
- //
3334
- /**
3335
- * Read half float
3336
- *
3337
- * @param {string} endian - ```big``` or ```little```
3338
- * @returns number
3339
- */
3340
- readHalfFloat(endian) {
3341
- return (0, common_js_1.rhalffloat)(this, endian);
3342
- }
3343
- /**
3344
- * Writes half float
3345
- *
3346
- * @param {number} value - value as int
3347
- * @param {string} endian - ``big`` or ``little`
3348
- */
3349
- writeHalfFloat(value, endian) {
3350
- return (0, common_js_1.whalffloat)(this, value, endian);
3351
- }
3352
- /**
3353
- * Read half float
3354
- *
3355
- * @param {string} endian - ```big``` or ```little```
3356
- * @returns number
3357
- */
3358
- halffloat(endian) {
3359
- return this.readHalfFloat(endian);
3360
- }
3361
- /**
3362
- * Read half float
3363
- *
3364
- * @param {string} endian - ```big``` or ```little```
3365
- * @returns number
3366
- */
3367
- half(endian) {
3368
- return this.readHalfFloat(endian);
3369
- }
3370
- /**
3371
- * Read half float
3372
- *
3373
- * @returns number
3374
- */
3375
- readHalfFloatBE() {
3376
- return this.readHalfFloat("big");
3377
- }
3378
- /**
3379
- * Read half float
3380
- *
3381
- * @returns number
3382
- */
3383
- halffloatbe() {
3384
- return this.readHalfFloat("big");
3385
- }
3386
- /**
3387
- * Read half float
3388
- *
3389
- * @returns number
3390
- */
3391
- halfbe() {
3392
- return this.readHalfFloat("big");
3393
- }
3394
- /**
3395
- * Read half float
3396
- *
3397
- * @returns number
3398
- */
3399
- readHalfFloatLE() {
3400
- return this.readHalfFloat("little");
3401
- }
3402
- /**
3403
- * Read half float
3404
- *
3405
- * @returns number
3406
- */
3407
- halffloatle() {
3408
- return this.readHalfFloat("little");
3409
- }
3410
- /**
3411
- * Read half float
3412
- *
3413
- * @returns number
3414
- */
3415
- halfle() {
3416
- return this.readHalfFloat("little");
3417
- }
3418
- //
3419
- //int read
3420
- //
3421
- /**
3422
- * Read 32 bit integer
3423
- *
3424
- * @param {boolean} unsigned - if value is unsigned or not
3425
- * @param {string} endian - ```big``` or ```little```
3426
- * @returns number
3427
- */
3428
- readInt32(unsigned, endian) {
3429
- return (0, common_js_1.rint32)(this, unsigned, endian);
3430
- }
3431
- /**
3432
- * Write int32
3433
- *
3434
- * @param {number} value - value as int
3435
- * @param {boolean} unsigned - if the value is unsigned
3436
- * @param {string} endian - ``big`` or ``little`
3437
- */
3438
- writeInt32(value, unsigned, endian) {
3439
- return (0, common_js_1.wint32)(this, value, unsigned, endian);
3440
- }
3441
- /**
3442
- * Read 32 bit integer
3443
- *
3444
- * @param {boolean} unsigned - if value is unsigned or not
3445
- * @param {string} endian - ```big``` or ```little```
3446
- * @returns number
3447
- */
3448
- int(unsigned, endian) {
3449
- return this.readInt32(unsigned, endian);
3450
- }
3451
- /**
3452
- * Read 32 bit integer
3453
- *
3454
- * @param {boolean} unsigned - if value is unsigned or not
3455
- * @param {string} endian - ```big``` or ```little```
3456
- * @returns number
3457
- */
3458
- double(unsigned, endian) {
3459
- return this.readInt32(unsigned, endian);
3460
- }
3461
- /**
3462
- * Read 32 bit integer
3463
- *
3464
- * @param {boolean} unsigned - if value is unsigned or not
3465
- * @param {string} endian - ```big``` or ```little```
3466
- * @returns number
3467
- */
3468
- int32(unsigned, endian) {
3469
- return this.readInt32(unsigned, endian);
3470
- }
3471
- /**
3472
- * Read 32 bit integer
3473
- *
3474
- * @param {boolean} unsigned - if value is unsigned or not
3475
- * @param {string} endian - ```big``` or ```little```
3476
- * @returns number
3477
- */
3478
- long(unsigned, endian) {
3479
- return this.readInt32(unsigned, endian);
3480
- }
3481
- /**
3482
- * Read unsigned 32 bit integer
3483
- *
3484
- * @returns number
3485
- */
3486
- readUInt() {
3487
- return this.readInt32(true);
3488
- }
3489
- /**
3490
- * Read unsigned 32 bit integer
3491
- *
3492
- * @returns number
3493
- */
3494
- uint() {
3495
- return this.readInt32(true);
3496
- }
3497
- /**
3498
- * Read unsigned 32 bit integer
3499
- *
3500
- * @returns number
3501
- */
3502
- udouble() {
3503
- return this.readInt32(true);
3504
- }
3505
- /**
3506
- * Read unsigned 32 bit integer
3507
- *
3508
- * @returns number
3509
- */
3510
- uint32() {
3511
- return this.readInt32(true);
3512
- }
3513
- /**
3514
- * Read unsigned 32 bit integer
3515
- *
3516
- * @returns number
3517
- */
3518
- ulong() {
3519
- return this.readInt32(true);
3520
- }
3521
- /**
3522
- * Read signed 32 bit integer
3523
- *
3524
- * @returns number
3525
- */
3526
- readInt32BE() {
3527
- return this.readInt32(false, "big");
3528
- }
3529
- /**
3530
- * Read signed 32 bit integer
3531
- *
3532
- * @returns number
3533
- */
3534
- intbe() {
3535
- return this.readInt32(false, "big");
3536
- }
3537
- /**
3538
- * Read signed 32 bit integer
3539
- *
3540
- * @returns number
3541
- */
3542
- doublebe() {
3543
- return this.readInt32(false, "big");
3544
- }
3545
- /**
3546
- * Read signed 32 bit integer
3547
- *
3548
- * @returns number
3549
- */
3550
- int32be() {
3551
- return this.readInt32(false, "big");
3552
- }
3553
- /**
3554
- * Read signed 32 bit integer
3555
- *
3556
- * @returns number
3557
- */
3558
- longbe() {
3559
- return this.readInt32(false, "big");
3560
- }
3561
- /**
3562
- * Read unsigned 32 bit integer
3563
- *
3564
- * @returns number
3565
- */
3566
- readUInt32BE() {
3567
- return this.readInt32(true, "big");
3568
- }
3569
- /**
3570
- * Read unsigned 32 bit integer
3571
- *
3572
- * @returns number
3573
- */
3574
- uintbe() {
3575
- return this.readInt32(true, "big");
3576
- }
3577
- /**
3578
- * Read unsigned 32 bit integer
3579
- *
3580
- * @returns number
3581
- */
3582
- udoublebe() {
3583
- return this.readInt32(true, "big");
3584
- }
3585
- /**
3586
- * Read unsigned 32 bit integer
3587
- *
3588
- * @returns number
3589
- */
3590
- uint32be() {
3591
- return this.readInt32(true, "big");
3592
- }
3593
- /**
3594
- * Read unsigned 32 bit integer
3595
- *
3596
- * @returns number
3597
- */
3598
- ulongbe() {
3599
- return this.readInt32(true, "big");
3600
- }
3601
- /**
3602
- * Read signed 32 bit integer
3603
- *
3604
- * @returns number
3605
- */
3606
- readInt32LE() {
3607
- return this.readInt32(false, "little");
3608
- }
3609
- /**
3610
- * Read signed 32 bit integer
3611
- *
3612
- * @returns number
3613
- */
3614
- intle() {
3615
- return this.readInt32(false, "little");
3616
- }
3617
- /**
3618
- * Read signed 32 bit integer
3619
- *
3620
- * @returns number
3621
- */
3622
- doublele() {
3623
- return this.readInt32(false, "little");
3624
- }
3625
- /**
3626
- * Read signed 32 bit integer
3627
- *
3628
- * @returns number
3629
- */
3630
- int32le() {
3631
- return this.readInt32(false, "little");
3632
- }
3633
- /**
3634
- * Read signed 32 bit integer
3635
- *
3636
- * @returns number
3637
- */
3638
- longle() {
3639
- return this.readInt32(false, "little");
3640
- }
3641
- /**
3642
- * Read signed 32 bit integer
3643
- *
3644
- * @returns number
3645
- */
3646
- readUInt32LE() {
3647
- return this.readInt32(true, "little");
3648
- }
3649
- /**
3650
- * Read signed 32 bit integer
3651
- *
3652
- * @returns number
3653
- */
3654
- uintle() {
3655
- return this.readInt32(true, "little");
3656
- }
3657
- /**
3658
- * Read signed 32 bit integer
3659
- *
3660
- * @returns number
3661
- */
3662
- udoublele() {
3663
- return this.readInt32(true, "little");
3664
- }
3665
- /**
3666
- * Read signed 32 bit integer
3667
- *
3668
- * @returns number
3669
- */
3670
- uint32le() {
3671
- return this.readInt32(true, "little");
3672
- }
3673
- /**
3674
- * Read signed 32 bit integer
3675
- *
3676
- * @returns number
3677
- */
3678
- ulongle() {
3679
- return this.readInt32(true, "little");
3680
- }
3681
- //
3682
- //float read
3683
- //
3684
- /**
3685
- * Read float
3686
- *
3687
- * @param {string} endian - ```big``` or ```little```
3688
- * @returns number
3689
- */
3690
- readFloat(endian) {
3691
- return (0, common_js_1.rfloat)(this, endian);
3692
- }
3693
- /**
3694
- * Write float
3695
- *
3696
- * @param {number} value - value as int
3697
- * @param {string} endian - ``big`` or ``little`
3698
- */
3699
- writeFloat(value, endian) {
3700
- return (0, common_js_1.wfloat)(this, value, endian);
3701
- }
3702
- /**
3703
- * Read float
3704
- *
3705
- * @param {string} endian - ```big``` or ```little```
3706
- * @returns number
3707
- */
3708
- float(endian) {
3709
- return this.readFloat(endian);
3710
- }
3711
- /**
3712
- * Read float
3713
- *
3714
- * @returns number
3715
- */
3716
- readFloatBE() {
3717
- return this.readFloat("big");
3718
- }
3719
- /**
3720
- * Read float
3721
- *
3722
- * @returns number
3723
- */
3724
- floatbe() {
3725
- return this.readFloat("big");
3726
- }
3727
- /**
3728
- * Read float
3729
- *
3730
- * @returns number
3731
- */
3732
- readFloatLE() {
3733
- return this.readFloat("little");
3734
- }
3735
- /**
3736
- * Read float
3737
- *
3738
- * @returns number
3739
- */
3740
- floatle() {
3741
- return this.readFloat("little");
3742
- }
3743
- //
3744
- //int64 reader
3745
- //
3746
- /**
3747
- * Read signed 64 bit integer
3748
- * @param {boolean} unsigned - if value is unsigned or not
3749
- * @param {string} endian - ```big``` or ```little```
3750
- * @returns number
3751
- */
3752
- readInt64(unsigned, endian) {
3753
- return (0, common_js_1.rint64)(this, unsigned, endian);
3754
- }
3755
- /**
3756
- * Write 64 bit integer
3757
- *
3758
- * @param {number} value - value as int
3759
- * @param {boolean} unsigned - if the value is unsigned
3760
- * @param {string} endian - ``big`` or ``little`
3761
- */
3762
- writeInt64(value, unsigned, endian) {
3763
- return (0, common_js_1.wint64)(this, value, unsigned, endian);
3764
- }
3765
- /**
3766
- * Read signed 64 bit integer
3767
- * @param {boolean} unsigned - if value is unsigned or not
3768
- * @param {string} endian - ```big``` or ```little```
3769
- * @returns number
3770
- */
3771
- int64(unsigned, endian) {
3772
- return this.readInt64(unsigned, endian);
3773
- }
3774
- /**
3775
- * Read signed 64 bit integer
3776
- * @param {boolean} unsigned - if value is unsigned or not
3777
- * @param {string} endian - ```big``` or ```little```
3778
- * @returns number
3779
- */
3780
- bigint(unsigned, endian) {
3781
- return this.readInt64(unsigned, endian);
3782
- }
3783
- /**
3784
- * Read signed 64 bit integer
3785
- * @param {boolean} unsigned - if value is unsigned or not
3786
- * @param {string} endian - ```big``` or ```little```
3787
- * @returns number
3788
- */
3789
- quad(unsigned, endian) {
3790
- return this.readInt64(unsigned, endian);
3791
- }
3792
- /**
3793
- * Read unsigned 64 bit integer
3794
- *
3795
- * @returns number
3796
- */
3797
- readUInt64() {
3798
- return this.readInt64(true);
3799
- }
3800
- /**
3801
- * Read unsigned 64 bit integer
3802
- *
3803
- * @returns number
3804
- */
3805
- uint64() {
3806
- return this.readInt64(true);
3807
- }
3808
- /**
3809
- * Read unsigned 64 bit integer
3810
- *
3811
- * @returns number
3812
- */
3813
- ubigint() {
3814
- return this.readInt64(true);
3815
- }
3816
- /**
3817
- * Read unsigned 64 bit integer
3818
- *
3819
- * @returns number
3820
- */
3821
- uquad() {
3822
- return this.readInt64(true);
3823
- }
3824
- /**
3825
- * Read signed 64 bit integer
3826
- *
3827
- * @returns number
3828
- */
3829
- readInt64BE() {
3830
- return this.readInt64(false, "big");
3831
- }
3832
- /**
3833
- * Read signed 64 bit integer
3834
- *
3835
- * @returns number
3836
- */
3837
- int64be() {
3838
- return this.readInt64(false, "big");
3839
- }
3840
- /**
3841
- * Read signed 64 bit integer
3842
- *
3843
- * @returns number
3844
- */
3845
- bigintbe() {
3846
- return this.readInt64(false, "big");
3847
- }
3848
- /**
3849
- * Read signed 64 bit integer
3850
- *
3851
- * @returns number
3852
- */
3853
- quadbe() {
3854
- return this.readInt64(false, "big");
3855
- }
3856
- /**
3857
- * Read unsigned 64 bit integer
3858
- *
3859
- * @returns number
3860
- */
3861
- readUInt64BE() {
3862
- return this.readInt64(true, "big");
3863
- }
3864
- /**
3865
- * Read unsigned 64 bit integer
3866
- *
3867
- * @returns number
3868
- */
3869
- uint64be() {
3870
- return this.readInt64(true, "big");
3871
- }
3872
- /**
3873
- * Read unsigned 64 bit integer
3874
- *
3875
- * @returns number
3876
- */
3877
- ubigintbe() {
3878
- return this.readInt64(true, "big");
3879
- }
3880
- /**
3881
- * Read unsigned 64 bit integer
3882
- *
3883
- * @returns number
3884
- */
3885
- uquadbe() {
3886
- return this.readInt64(true, "big");
3887
- }
3888
- /**
3889
- * Read signed 64 bit integer
3890
- *
3891
- * @returns number
3892
- */
3893
- readInt64LE() {
3894
- return this.readInt64(false, "little");
3895
- }
3896
- /**
3897
- * Read signed 64 bit integer
3898
- *
3899
- * @returns number
3900
- */
3901
- int64le() {
3902
- return this.readInt64(false, "little");
3903
- }
3904
- /**
3905
- * Read signed 64 bit integer
3906
- *
3907
- * @returns number
3908
- */
3909
- bigintle() {
3910
- return this.readInt64(false, "little");
3911
- }
3912
- /**
3913
- * Read signed 64 bit integer
3914
- *
3915
- * @returns number
3916
- */
3917
- quadle() {
3918
- return this.readInt64(false, "little");
3919
- }
3920
- /**
3921
- * Read unsigned 64 bit integer
3922
- *
3923
- * @returns number
3924
- */
3925
- readUInt64LE() {
3926
- return this.readInt64(true, "little");
3927
- }
3928
- /**
3929
- * Read unsigned 64 bit integer
3930
- *
3931
- * @returns number
3932
- */
3933
- uint64le() {
3934
- return this.readInt64(true, "little");
3935
- }
3936
- /**
3937
- * Read unsigned 64 bit integer
3938
- *
3939
- * @returns number
3940
- */
3941
- ubigintle() {
3942
- return this.readInt64(true, "little");
3943
- }
3944
- /**
3945
- * Read unsigned 64 bit integer
3946
- *
3947
- * @returns number
3948
- */
3949
- uquadle() {
3950
- return this.readInt64(true, "little");
3951
- }
3952
- //
3953
- //doublefloat reader
3954
- //
3955
- /**
3956
- * Read double float
3957
- *
3958
- * @param {string} endian - ```big``` or ```little```
3959
- * @returns number
3960
- */
3961
- readDoubleFloat(endian) {
3962
- return (0, common_js_1.rdfloat)(this, endian);
3963
- }
3964
- /**
3965
- * Writes double float
3966
- *
3967
- * @param {number} value - value as int
3968
- * @param {number} offset - byte offset (default last write position)
3969
- * @param {string} endian - ``big`` or ``little`
3970
- */
3971
- writeDoubleFloat(value, endian) {
3972
- return (0, common_js_1.wdfloat)(this, value, endian);
3973
- }
3974
- /**
3975
- * Read double float
3976
- *
3977
- * @param {string} endian - ```big``` or ```little```
3978
- * @returns number
3979
- */
3980
- doublefloat(endian) {
3981
- return this.readDoubleFloat(endian);
3982
- }
3983
- /**
3984
- * Read double float
3985
- *
3986
- * @param {string} endian - ```big``` or ```little```
3987
- * @returns number
3988
- */
3989
- dfloat(endian) {
3990
- return this.readDoubleFloat(endian);
3991
- }
3992
- /**
3993
- * Read double float
3994
- *
3995
- * @returns number
3996
- */
3997
- readDoubleFloatBE() {
3998
- return this.readDoubleFloat("big");
3999
- }
4000
- /**
4001
- * Read double float
4002
- *
4003
- * @returns number
4004
- */
4005
- dfloatebe() {
4006
- return this.readDoubleFloat("big");
4007
- }
4008
- /**
4009
- * Read double float
4010
- *
4011
- * @returns number
4012
- */
4013
- doublefloatbe() {
4014
- return this.readDoubleFloat("big");
4015
- }
4016
- /**
4017
- * Read double float
4018
- *
4019
- * @returns number
4020
- */
4021
- readDoubleFloatLE() {
4022
- return this.readDoubleFloat("little");
4023
- }
4024
- /**
4025
- * Read double float
4026
- *
4027
- * @returns number
4028
- */
4029
- dfloatle() {
4030
- return this.readDoubleFloat("little");
4031
- }
4032
- /**
4033
- * Read double float
4034
- *
4035
- * @returns number
4036
- */
4037
- doublefloatle() {
4038
- return this.readDoubleFloat("little");
4039
- }
4040
- //
4041
- //string reader
4042
- //
4043
- /**
4044
- * Reads string, use options object for different types
4045
- *
4046
- * @param {object} options
4047
- * ```javascript
4048
- * {
4049
- * length: number, //for fixed length, non-terminate value utf strings
4050
- * stringType: "utf-8", //utf-8, utf-16, pascal or wide-pascal
4051
- * terminateValue: 0x00, // only for non-fixed length utf strings
4052
- * lengthReadSize: 1, //for pascal strings. 1, 2 or 4 byte length read size
4053
- * stripNull: true, // removes 0x00 characters
4054
- * encoding: "utf-8", //TextEncoder accepted types
4055
- * endian: "little", //for wide-pascal and utf-16
4056
- * }
4057
- * ```
4058
- * @return string
4059
- */
4060
- readString(options) {
4061
- return (0, common_js_1.rstring)(this, options);
4062
- }
4063
- /**
4064
- * Writes string, use options object for different types
4065
- *
4066
- *
4067
- * @param {string} string - text string
4068
- * @param {object} options - options:
4069
- * ```javascript
4070
- * {
4071
- * length: string.length, //for fixed length, non-terminate value utf strings
4072
- * stringType: "utf-8", //utf-8, utf-16, pascal or wide-pascal
4073
- * terminateValue: 0x00, // only with stringType: "utf"
4074
- * lengthWriteSize: 1, //for pascal strings. 1, 2 or 4 byte length write size
4075
- * encoding: "utf-8", //TextEncoder accepted types
4076
- * endian: "little", //for wide-pascal and utf-16
4077
- * }
4078
- * ```
4079
- */
4080
- writeString(string, options) {
4081
- return (0, common_js_1.wstring)(this, string, options);
4082
- }
4083
- /**
4084
- * Reads string, use options object for different types
4085
- *
4086
- * @param {object} options
4087
- * ```javascript
4088
- * {
4089
- * length: number, //for fixed length, non-terminate value utf strings
4090
- * stringType: "utf-8", //utf-8, utf-16, pascal or wide-pascal
4091
- * terminateValue: 0x00, // only for non-fixed length utf strings
4092
- * lengthReadSize: 1, //for pascal strings. 1, 2 or 4 byte length read size
4093
- * stripNull: true, // removes 0x00 characters
4094
- * encoding: "utf-8", //TextEncoder accepted types
4095
- * endian: "little", //for wide-pascal and utf-16
4096
- * }
4097
- * ```
4098
- * @return string
4099
- */
4100
- string(options) {
4101
- return this.readString(options);
4102
- }
4103
- /**
4104
- * Reads UTF-8 (C) string
4105
- *
4106
- * @param {number} length - for fixed length utf strings
4107
- * @param {number} terminateValue - for non-fixed length utf strings
4108
- * @param {boolean} stripNull - removes 0x00 characters
4109
- *
4110
- * @return string
4111
- */
4112
- utf8string(length, terminateValue, stripNull) {
4113
- return this.string({ stringType: "utf-8", encoding: "utf-8", length: length, terminateValue: terminateValue, stripNull: stripNull });
4114
- }
4115
- /**
4116
- * Reads UTF-8 (C) string
4117
- *
4118
- * @param {number} length - for fixed length utf strings
4119
- * @param {number} terminateValue - for non-fixed length utf strings
4120
- * @param {boolean} stripNull - removes 0x00 characters
4121
- *
4122
- * @return string
4123
- */
4124
- cstring(length, terminateValue, stripNull) {
4125
- return this.string({ stringType: "utf-8", encoding: "utf-8", length: length, terminateValue: terminateValue, stripNull: stripNull });
4126
- }
4127
- /**
4128
- * Reads ANSI string
4129
- *
4130
- * @param {number} length - for fixed length utf strings
4131
- * @param {number} terminateValue - for non-fixed length utf strings
4132
- * @param {boolean} stripNull - removes 0x00 characters
4133
- *
4134
- * @return string
4135
- */
4136
- ansistring(length, terminateValue, stripNull) {
4137
- return this.string({ stringType: "utf-8", encoding: "windows-1252", length: length, terminateValue: terminateValue, stripNull: stripNull });
4138
- }
4139
- /**
4140
- * Reads UTF-16 (Unicode) string
4141
- *
4142
- * @param {number} length - for fixed length utf strings
4143
- * @param {number} terminateValue - for non-fixed length utf strings
4144
- * @param {boolean} stripNull - removes 0x00 characters
4145
- * @param {string} endian - ``big`` or ``little``
4146
- *
4147
- * @return string
4148
- */
4149
- utf16string(length, terminateValue, stripNull, endian) {
4150
- return this.string({ stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: endian, stripNull: stripNull });
4151
- }
4152
- /**
4153
- * Reads UTF-16 (Unicode) string
4154
- *
4155
- * @param {number} length - for fixed length utf strings
4156
- * @param {number} terminateValue - for non-fixed length utf strings
4157
- * @param {boolean} stripNull - removes 0x00 characters
4158
- * @param {string} endian - ``big`` or ``little``
4159
- *
4160
- * @return string
4161
- */
4162
- unistring(length, terminateValue, stripNull, endian) {
4163
- return this.string({ stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: endian, stripNull: stripNull });
4164
- }
4165
- /**
4166
- * Reads UTF-16 (Unicode) string in little endian order
4167
- *
4168
- * @param {number} length - for fixed length utf strings
4169
- * @param {number} terminateValue - for non-fixed length utf strings
4170
- * @param {boolean} stripNull - removes 0x00 characters
4171
- *
4172
- * @return string
4173
- */
4174
- utf16stringle(length, terminateValue, stripNull) {
4175
- return this.string({ stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "little", stripNull: stripNull });
4176
- }
4177
- /**
4178
- * Reads UTF-16 (Unicode) string in little endian order
4179
- *
4180
- * @param {number} length - for fixed length utf strings
4181
- * @param {number} terminateValue - for non-fixed length utf strings
4182
- * @param {boolean} stripNull - removes 0x00 characters
4183
- *
4184
- * @return string
4185
- */
4186
- unistringle(length, terminateValue, stripNull) {
4187
- return this.string({ stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "little", stripNull: stripNull });
4188
- }
4189
- /**
4190
- * Reads UTF-16 (Unicode) string in big endian order
4191
- *
4192
- * @param {number} length - for fixed length utf strings
4193
- * @param {number} terminateValue - for non-fixed length utf strings
4194
- * @param {boolean} stripNull - removes 0x00 characters
4195
- *
4196
- * @return string
4197
- */
4198
- utf16stringbe(length, terminateValue, stripNull) {
4199
- return this.string({ stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "big", stripNull: stripNull });
4200
- }
4201
- /**
4202
- * Reads UTF-16 (Unicode) string in big endian order
4203
- *
4204
- * @param {number} length - for fixed length utf strings
4205
- * @param {number} terminateValue - for non-fixed length utf strings
4206
- * @param {boolean} stripNull - removes 0x00 characters
4207
- *
4208
- * @return string
4209
- */
4210
- unistringbe(length, terminateValue, stripNull) {
4211
- return this.string({ stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "big", stripNull: stripNull });
4212
- }
4213
- /**
4214
- * Reads Pascal string
4215
- *
4216
- * @param {number} lengthReadSize - 1, 2 or 4 byte length write size (default 1)
4217
- * @param {boolean} stripNull - removes 0x00 characters
4218
- * @param {string} endian - ``big`` or ``little``
4219
- *
4220
- * @return string
4221
- */
4222
- pstring(lengthReadSize, stripNull, endian) {
4223
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: lengthReadSize, stripNull: stripNull, endian: endian });
4224
- }
4225
- /**
4226
- * Reads Pascal string 1 byte length read
4227
- *
4228
- * @param {boolean} stripNull - removes 0x00 characters
4229
- * @param {string} endian - ``big`` or ``little``
4230
- *
4231
- * @return string
4232
- */
4233
- pstring1(stripNull, endian) {
4234
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 1, stripNull: stripNull, endian: endian });
4235
- }
4236
- /**
4237
- * Reads Pascal string 1 byte length read in little endian order
4238
- *
4239
- * @param {boolean} stripNull - removes 0x00 characters
4240
- *
4241
- * @return string
4242
- */
4243
- pstring1le(stripNull) {
4244
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 1, stripNull: stripNull, endian: "little" });
4245
- }
4246
- /**
4247
- * Reads Pascal string 1 byte length read in big endian order
4248
- *
4249
- * @param {boolean} stripNull - removes 0x00 characters
4250
- *
4251
- * @return string
4252
- */
4253
- pstring1be(stripNull) {
4254
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 1, stripNull: stripNull, endian: "big" });
4255
- }
4256
- /**
4257
- * Reads Pascal string 2 byte length read
4258
- *
4259
- * @param {boolean} stripNull - removes 0x00 characters
4260
- * @param {string} endian - ``big`` or ``little``
4261
- *
4262
- * @return string
4263
- */
4264
- pstring2(stripNull, endian) {
4265
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 2, stripNull: stripNull, endian: endian });
4266
- }
4267
- /**
4268
- * Reads Pascal string 2 byte length read in little endian order
4269
- *
4270
- * @param {boolean} stripNull - removes 0x00 characters
4271
- *
4272
- * @return string
4273
- */
4274
- pstring2le(stripNull) {
4275
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 2, stripNull: stripNull, endian: "little" });
4276
- }
4277
- /**
4278
- * Reads Pascal string 2 byte length read in big endian order
4279
- *
4280
- * @param {boolean} stripNull - removes 0x00 characters
4281
- *
4282
- * @return string
4283
- */
4284
- pstring2be(stripNull) {
4285
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 2, stripNull: stripNull, endian: "big" });
4286
- }
4287
- /**
4288
- * Reads Pascal string 4 byte length read
4289
- *
4290
- * @param {boolean} stripNull - removes 0x00 characters
4291
- * @param {string} endian - ``big`` or ``little``
4292
- *
4293
- * @return string
4294
- */
4295
- pstring4(stripNull, endian) {
4296
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 4, stripNull: stripNull, endian: endian });
4297
- }
4298
- /**
4299
- * Reads Pascal string 4 byte length read in little endian order
4300
- *
4301
- * @param {boolean} stripNull - removes 0x00 characters
4302
- *
4303
- * @return string
4304
- */
4305
- pstring4le(stripNull) {
4306
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 4, stripNull: stripNull, endian: "little" });
4307
- }
4308
- /**
4309
- * Reads Pascal string 4 byte length read in big endian order
4310
- *
4311
- * @param {boolean} stripNull - removes 0x00 characters
4312
- *
4313
- * @return string
4314
- */
4315
- pstring4be(stripNull) {
4316
- return this.string({ stringType: "pascal", encoding: "utf-8", lengthReadSize: 4, stripNull: stripNull, endian: "big" });
4317
- }
4318
- /**
4319
- * Reads Wide-Pascal string
4320
- *
4321
- * @param {number} lengthReadSize - 1, 2 or 4 byte length write size (default 1)
4322
- * @param {boolean} stripNull - removes 0x00 characters
4323
- * @param {string} endian - ``big`` or ``little``
4324
- *
4325
- * @return string
4326
- */
4327
- wpstring(lengthReadSize, stripNull, endian) {
4328
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: lengthReadSize, endian: endian, stripNull: stripNull });
4329
- }
4330
- /**
4331
- * Reads Wide-Pascal string 1 byte length read
4332
- *
4333
- * @param {boolean} stripNull - removes 0x00 characters
4334
- * @param {string} endian - ``big`` or ``little``
4335
- *
4336
- * @return string
4337
- */
4338
- wpstring1(stripNull, endian) {
4339
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: 1, endian: endian, stripNull: stripNull });
4340
- }
4341
- /**
4342
- * Reads Wide-Pascal string 2 byte length read
4343
- *
4344
- * @param {boolean} stripNull - removes 0x00 characters
4345
- * @param {string} endian - ``big`` or ``little``
4346
- *
4347
- * @return string
4348
- */
4349
- wpstring2(stripNull, endian) {
4350
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: 2, endian: endian, stripNull: stripNull });
4351
- }
4352
- /**
4353
- * Reads Wide-Pascal string 2 byte length read in little endian order
4354
- *
4355
- * @param {boolean} stripNull - removes 0x00 characters
4356
- *
4357
- * @return string
4358
- */
4359
- wpstring2le(stripNull) {
4360
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: 2, endian: "little", stripNull: stripNull });
4361
- }
4362
- /**
4363
- * Reads Wide-Pascal string 2 byte length read in big endian order
4364
- *
4365
- * @param {boolean} stripNull - removes 0x00 characters
4366
- *
4367
- * @return string
4368
- */
4369
- wpstring2be(stripNull) {
4370
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: 2, endian: "big", stripNull: stripNull });
4371
- }
4372
- /**
4373
- * Reads Wide-Pascal string 4 byte length read
4374
- *
4375
- * @param {boolean} stripNull - removes 0x00 characters
4376
- * @param {string} endian - ``big`` or ``little``
4377
- *
4378
- * @return string
4379
- */
4380
- wpstring4(stripNull, endian) {
4381
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: 4, endian: endian, stripNull: stripNull });
4382
- }
4383
- /**
4384
- * Reads Wide-Pascal string 4 byte length read in big endian order
4385
- *
4386
- * @param {boolean} stripNull - removes 0x00 characters
4387
- *
4388
- * @return string
4389
- */
4390
- wpstring4be(stripNull) {
4391
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: 4, endian: "big", stripNull: stripNull });
4392
- }
4393
- /**
4394
- * Reads Wide-Pascal string 4 byte length read in little endian order
4395
- *
4396
- * @param {boolean} stripNull - removes 0x00 characters
4397
- *
4398
- * @return string
4399
- */
4400
- wpstring4le(stripNull) {
4401
- return this.string({ stringType: "wide-pascal", encoding: "utf-16", lengthReadSize: 4, endian: "little", stripNull: stripNull });
4402
- }
4403
- }
4404
- exports.bireader = bireader;
4405
- //# sourceMappingURL=reader.js.map