bireader 1.0.36 → 1.0.39
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -0
- package/lib/cjs/index.d.ts +232 -230
- package/lib/cjs/index.d.ts.map +1 -1
- package/lib/cjs/index.js +277 -220
- package/lib/cjs/index.js.map +1 -1
- package/lib/esm/index.d.ts +232 -230
- package/lib/esm/index.d.ts.map +1 -1
- package/lib/esm/index.js.map +1 -1
- package/lib/esm/index.mjs +312 -219
- package/package.json +1 -1
package/lib/esm/index.mjs
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
|
|
1
|
+
function isBuffer(obj) {
|
|
2
2
|
return buffcheck(obj);
|
|
3
3
|
}
|
|
4
|
-
|
|
4
|
+
function check_size(_this, write_bytes, write_bit, offset) {
|
|
5
5
|
return checkSize(_this, write_bytes || 0, write_bit || 0, offset || _this.offset);
|
|
6
6
|
}
|
|
7
|
-
|
|
7
|
+
function buffcheck(obj) {
|
|
8
8
|
return (typeof Buffer !== 'undefined' && obj instanceof Buffer);
|
|
9
9
|
}
|
|
10
|
-
|
|
10
|
+
function arraybuffcheck(_this, obj) {
|
|
11
11
|
return obj instanceof Uint8Array || isBuffer(obj);
|
|
12
12
|
}
|
|
13
|
-
|
|
13
|
+
function extendarray(_this, to_padd) {
|
|
14
14
|
if ((typeof Buffer !== 'undefined' && _this.data instanceof Buffer)) {
|
|
15
15
|
var paddbuffer = Buffer.alloc(to_padd);
|
|
16
16
|
_this.data = Buffer.concat([_this.data, paddbuffer]);
|
|
@@ -20,7 +20,7 @@ export function extendarray(_this, to_padd) {
|
|
|
20
20
|
_this.data = new Uint8Array([..._this.data, ...addArray]);
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
|
-
|
|
23
|
+
function checkSize(_this, write_bytes, write_bit, offset) {
|
|
24
24
|
const bits = (write_bit || 0) + _this.bitoffset;
|
|
25
25
|
var new_off = (offset || _this.offset);
|
|
26
26
|
var writesize = write_bytes || 0;
|
|
@@ -43,7 +43,7 @@ export function checkSize(_this, write_bytes, write_bit, offset) {
|
|
|
43
43
|
//start read location
|
|
44
44
|
return new_off;
|
|
45
45
|
}
|
|
46
|
-
|
|
46
|
+
function skip(_this, bytes, bits) {
|
|
47
47
|
var new_size = (((bytes || 0) + _this.offset) + Math.ceil((_this.bitoffset + (bits || 0)) / 8));
|
|
48
48
|
if (bits && bits < 0) {
|
|
49
49
|
new_size = Math.floor(((((bytes || 0) + _this.offset) * 8) + _this.bitoffset + (bits || 0)) / 8);
|
|
@@ -57,11 +57,30 @@ export function skip(_this, bytes, bits) {
|
|
|
57
57
|
throw new Error("\x1b[33m[Strict mode]\x1b[0m: Seek of range of data: seek " + new_size + " of " + _this.size);
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
-
|
|
61
|
-
_this.bitoffset
|
|
62
|
-
|
|
60
|
+
// Adjust byte offset based on bit overflow
|
|
61
|
+
_this.offset += Math.floor((_this.bitoffset + (bits || 0)) / 8);
|
|
62
|
+
// Adjust bit offset
|
|
63
|
+
_this.bitoffset = (_this.bitoffset + (bits || 0) + 64) % 8;
|
|
64
|
+
// Adjust byte offset based on byte overflow
|
|
65
|
+
_this.offset += bytes;
|
|
66
|
+
// Ensure bit offset stays between 0-7
|
|
67
|
+
_this.bitoffset = Math.min(Math.max(_this.bitoffset, 0), 7);
|
|
68
|
+
// Ensure offset doesn't go negative
|
|
69
|
+
_this.offset = Math.max(_this.offset, 0);
|
|
63
70
|
}
|
|
64
|
-
|
|
71
|
+
function align(_this, n) {
|
|
72
|
+
var a = _this.offset % n;
|
|
73
|
+
if (a) {
|
|
74
|
+
_this.skip(n - a);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
function alignRev(_this, n) {
|
|
78
|
+
var a = _this.offset % n;
|
|
79
|
+
if (a) {
|
|
80
|
+
_this.skip(a * -1);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
function goto(_this, byte, bit) {
|
|
65
84
|
const new_size = (byte + Math.ceil((bit || 0) / 8));
|
|
66
85
|
if (new_size > _this.size) {
|
|
67
86
|
if (_this.strict == false) {
|
|
@@ -75,7 +94,7 @@ export function goto(_this, byte, bit) {
|
|
|
75
94
|
_this.offset = byte;
|
|
76
95
|
_this.bitoffset = (bit || 0) % 8;
|
|
77
96
|
}
|
|
78
|
-
|
|
97
|
+
function remove(_this, startOffset, endOffset, consume, remove, fillValue) {
|
|
79
98
|
const new_start = Math.abs(startOffset || 0);
|
|
80
99
|
const new_offset = (endOffset || _this.offset);
|
|
81
100
|
if (new_offset > _this.size) {
|
|
@@ -128,7 +147,7 @@ export function remove(_this, startOffset, endOffset, consume, remove, fillValue
|
|
|
128
147
|
}
|
|
129
148
|
return data_removed;
|
|
130
149
|
}
|
|
131
|
-
|
|
150
|
+
function addData(_this, data, consume, offset, repalce) {
|
|
132
151
|
if (_this.strict == true) {
|
|
133
152
|
_this.errorDump ? "\x1b[31m[Error]\x1b[0m: hexdump:\n" + _this.hexdump() : "";
|
|
134
153
|
throw new Error(`\x1b[33m[Strict mode]\x1b[0m: Can not insert data in strict mode. Use unrestrict() to enable.`);
|
|
@@ -186,7 +205,7 @@ export function addData(_this, data, consume, offset, repalce) {
|
|
|
186
205
|
_this.bitoffset = 0;
|
|
187
206
|
}
|
|
188
207
|
}
|
|
189
|
-
|
|
208
|
+
function hexDump(_this, options) {
|
|
190
209
|
var length = options && options.length;
|
|
191
210
|
var startByte = options && options.startByte;
|
|
192
211
|
var supressUnicode = options && options.supressUnicode || false;
|
|
@@ -368,7 +387,7 @@ export function hexDump(_this, options) {
|
|
|
368
387
|
}
|
|
369
388
|
console.log(rows.join("\n"));
|
|
370
389
|
}
|
|
371
|
-
|
|
390
|
+
function AND(_this, and_key, start, end, consume) {
|
|
372
391
|
const input = _this.data;
|
|
373
392
|
if ((end || 0) > _this.size) {
|
|
374
393
|
if (_this.strict == false) {
|
|
@@ -389,7 +408,7 @@ export function AND(_this, and_key, start, end, consume) {
|
|
|
389
408
|
}
|
|
390
409
|
}
|
|
391
410
|
else {
|
|
392
|
-
if (_this
|
|
411
|
+
if (arraybuffcheck(_this, and_key)) {
|
|
393
412
|
let number = -1;
|
|
394
413
|
for (let i = (start || 0); i < Math.min(end || _this.size, _this.size); i++) {
|
|
395
414
|
if (number != and_key.length - 1) {
|
|
@@ -410,7 +429,7 @@ export function AND(_this, and_key, start, end, consume) {
|
|
|
410
429
|
}
|
|
411
430
|
}
|
|
412
431
|
}
|
|
413
|
-
|
|
432
|
+
function OR(_this, or_key, start, end, consume) {
|
|
414
433
|
const input = _this.data;
|
|
415
434
|
if ((end || 0) > _this.size) {
|
|
416
435
|
if (_this.strict == false) {
|
|
@@ -431,7 +450,7 @@ export function OR(_this, or_key, start, end, consume) {
|
|
|
431
450
|
}
|
|
432
451
|
}
|
|
433
452
|
else {
|
|
434
|
-
if (_this
|
|
453
|
+
if (arraybuffcheck(_this, or_key)) {
|
|
435
454
|
let number = -1;
|
|
436
455
|
for (let i = (start || 0); i < Math.min(end || _this.size, _this.size); i++) {
|
|
437
456
|
if (number != or_key.length - 1) {
|
|
@@ -452,7 +471,7 @@ export function OR(_this, or_key, start, end, consume) {
|
|
|
452
471
|
}
|
|
453
472
|
}
|
|
454
473
|
}
|
|
455
|
-
|
|
474
|
+
function XOR(_this, xor_key, start, end, consume) {
|
|
456
475
|
const input = _this.data;
|
|
457
476
|
if ((end || 0) > _this.size) {
|
|
458
477
|
if (_this.strict == false) {
|
|
@@ -473,7 +492,7 @@ export function XOR(_this, xor_key, start, end, consume) {
|
|
|
473
492
|
}
|
|
474
493
|
}
|
|
475
494
|
else {
|
|
476
|
-
if (_this
|
|
495
|
+
if (arraybuffcheck(_this, xor_key)) {
|
|
477
496
|
let number = -1;
|
|
478
497
|
for (let i = (start || 0); i < Math.min(end || _this.size, _this.size); i++) {
|
|
479
498
|
if (number != xor_key.length - 1) {
|
|
@@ -494,7 +513,7 @@ export function XOR(_this, xor_key, start, end, consume) {
|
|
|
494
513
|
}
|
|
495
514
|
}
|
|
496
515
|
}
|
|
497
|
-
|
|
516
|
+
function NOT(_this, start, end, consume) {
|
|
498
517
|
if ((end || 0) > _this.size) {
|
|
499
518
|
if (_this.strict == false) {
|
|
500
519
|
_this.extendArray((end || 0) - _this.size);
|
|
@@ -512,7 +531,7 @@ export function NOT(_this, start, end, consume) {
|
|
|
512
531
|
}
|
|
513
532
|
}
|
|
514
533
|
}
|
|
515
|
-
|
|
534
|
+
function LSHIFT(_this, shift_key, start, end, consume) {
|
|
516
535
|
const input = _this.data;
|
|
517
536
|
if ((end || 0) > _this.size) {
|
|
518
537
|
if (_this.strict == false) {
|
|
@@ -533,7 +552,7 @@ export function LSHIFT(_this, shift_key, start, end, consume) {
|
|
|
533
552
|
}
|
|
534
553
|
}
|
|
535
554
|
else {
|
|
536
|
-
if (_this
|
|
555
|
+
if (arraybuffcheck(_this, shift_key)) {
|
|
537
556
|
let number = -1;
|
|
538
557
|
for (let i = (start || 0); i < Math.min(end || _this.size, _this.size); i++) {
|
|
539
558
|
if (number != shift_key.length - 1) {
|
|
@@ -554,7 +573,7 @@ export function LSHIFT(_this, shift_key, start, end, consume) {
|
|
|
554
573
|
}
|
|
555
574
|
}
|
|
556
575
|
}
|
|
557
|
-
|
|
576
|
+
function RSHIFT(_this, shift_key, start, end, consume) {
|
|
558
577
|
const input = _this.data;
|
|
559
578
|
if ((end || 0) > _this.size) {
|
|
560
579
|
if (_this.strict == false) {
|
|
@@ -575,7 +594,7 @@ export function RSHIFT(_this, shift_key, start, end, consume) {
|
|
|
575
594
|
}
|
|
576
595
|
}
|
|
577
596
|
else {
|
|
578
|
-
if (_this
|
|
597
|
+
if (arraybuffcheck(_this, shift_key)) {
|
|
579
598
|
let number = -1;
|
|
580
599
|
for (let i = (start || 0); i < Math.min(end || _this.size, _this.size); i++) {
|
|
581
600
|
if (number != shift_key.length - 1) {
|
|
@@ -596,7 +615,7 @@ export function RSHIFT(_this, shift_key, start, end, consume) {
|
|
|
596
615
|
}
|
|
597
616
|
}
|
|
598
617
|
}
|
|
599
|
-
|
|
618
|
+
function ADD(_this, add_key, start, end, consume) {
|
|
600
619
|
const input = _this.data;
|
|
601
620
|
if ((end || 0) > _this.size) {
|
|
602
621
|
if (_this.strict == false) {
|
|
@@ -617,7 +636,7 @@ export function ADD(_this, add_key, start, end, consume) {
|
|
|
617
636
|
}
|
|
618
637
|
}
|
|
619
638
|
else {
|
|
620
|
-
if (_this
|
|
639
|
+
if (arraybuffcheck(_this, add_key)) {
|
|
621
640
|
let number = -1;
|
|
622
641
|
for (let i = (start || 0); i < Math.min(end || _this.size, _this.size); i++) {
|
|
623
642
|
if (number != add_key.length - 1) {
|
|
@@ -638,7 +657,7 @@ export function ADD(_this, add_key, start, end, consume) {
|
|
|
638
657
|
}
|
|
639
658
|
}
|
|
640
659
|
}
|
|
641
|
-
|
|
660
|
+
function wbit(_this, value, bits, unsigned, endian) {
|
|
642
661
|
if (value == undefined) {
|
|
643
662
|
throw new Error('Must supply value.');
|
|
644
663
|
}
|
|
@@ -698,7 +717,7 @@ export function wbit(_this, value, bits, unsigned, endian) {
|
|
|
698
717
|
_this.offset = _this.offset + Math.floor(((bits) + _this.bitoffset) / 8); //end byte
|
|
699
718
|
_this.bitoffset = ((bits) + _this.bitoffset) % 8;
|
|
700
719
|
}
|
|
701
|
-
|
|
720
|
+
function rbit(_this, bits, unsigned, endian) {
|
|
702
721
|
if (bits == undefined || typeof bits != "number") {
|
|
703
722
|
throw new Error("Enter number of bits to read");
|
|
704
723
|
}
|
|
@@ -742,7 +761,7 @@ export function rbit(_this, bits, unsigned, endian) {
|
|
|
742
761
|
}
|
|
743
762
|
return value;
|
|
744
763
|
}
|
|
745
|
-
|
|
764
|
+
function wbyte(_this, value, unsigned) {
|
|
746
765
|
check_size(_this, 1, 0);
|
|
747
766
|
if (unsigned == true) {
|
|
748
767
|
if (value < 0 || value > 255) {
|
|
@@ -762,7 +781,7 @@ export function wbyte(_this, value, unsigned) {
|
|
|
762
781
|
_this.offset += 1;
|
|
763
782
|
_this.bitoffset = 0;
|
|
764
783
|
}
|
|
765
|
-
|
|
784
|
+
function rbyte(_this, unsigned) {
|
|
766
785
|
check_size(_this, 1);
|
|
767
786
|
var read = _this.data[_this.offset];
|
|
768
787
|
_this.offset += 1;
|
|
@@ -774,7 +793,7 @@ export function rbyte(_this, unsigned) {
|
|
|
774
793
|
return read > 127 ? read - 256 : read;
|
|
775
794
|
}
|
|
776
795
|
}
|
|
777
|
-
|
|
796
|
+
function wint16(_this, value, unsigned, endian) {
|
|
778
797
|
check_size(_this, 2, 0);
|
|
779
798
|
if (unsigned == true) {
|
|
780
799
|
if (value < 0 || value > 65535) {
|
|
@@ -801,7 +820,7 @@ export function wint16(_this, value, unsigned, endian) {
|
|
|
801
820
|
_this.offset += 2;
|
|
802
821
|
_this.bitoffset = 0;
|
|
803
822
|
}
|
|
804
|
-
|
|
823
|
+
function rint16(_this, unsigned, endian) {
|
|
805
824
|
check_size(_this, 2);
|
|
806
825
|
var read;
|
|
807
826
|
if ((endian != undefined ? endian : _this.endian) == "little") {
|
|
@@ -819,7 +838,7 @@ export function rint16(_this, unsigned, endian) {
|
|
|
819
838
|
return read & 0xFFFF;
|
|
820
839
|
}
|
|
821
840
|
}
|
|
822
|
-
|
|
841
|
+
function rhalffloat(_this, endian) {
|
|
823
842
|
var uint16Value = _this.readInt16(true, (endian != undefined ? endian : _this.endian));
|
|
824
843
|
const sign = (uint16Value & 0x8000) >> 15;
|
|
825
844
|
const exponent = (uint16Value & 0x7C00) >> 10;
|
|
@@ -848,7 +867,7 @@ export function rhalffloat(_this, endian) {
|
|
|
848
867
|
}
|
|
849
868
|
return floatValue;
|
|
850
869
|
}
|
|
851
|
-
|
|
870
|
+
function whalffloat(_this, value, endian) {
|
|
852
871
|
check_size(_this, 2, 0);
|
|
853
872
|
const maxValue = 65504;
|
|
854
873
|
const minValue = 5.96e-08;
|
|
@@ -891,7 +910,7 @@ export function whalffloat(_this, value, endian) {
|
|
|
891
910
|
_this.offset += 2;
|
|
892
911
|
_this.bitoffset = 0;
|
|
893
912
|
}
|
|
894
|
-
|
|
913
|
+
function wint32(_this, value, unsigned, endian) {
|
|
895
914
|
check_size(_this, 4, 0);
|
|
896
915
|
if (unsigned == true) {
|
|
897
916
|
if (value < 0 || value > 4294967295) {
|
|
@@ -922,7 +941,7 @@ export function wint32(_this, value, unsigned, endian) {
|
|
|
922
941
|
_this.offset += 4;
|
|
923
942
|
_this.bitoffset = 0;
|
|
924
943
|
}
|
|
925
|
-
|
|
944
|
+
function rint32(_this, unsigned, endian) {
|
|
926
945
|
check_size(_this, 4);
|
|
927
946
|
var read;
|
|
928
947
|
if ((endian != undefined ? endian : _this.endian) == "little") {
|
|
@@ -940,7 +959,7 @@ export function rint32(_this, unsigned, endian) {
|
|
|
940
959
|
return read >>> 0;
|
|
941
960
|
}
|
|
942
961
|
}
|
|
943
|
-
|
|
962
|
+
function rfloat(_this, endian) {
|
|
944
963
|
var uint32Value = _this.readInt32(true, (endian == undefined ? _this.endian : endian));
|
|
945
964
|
// Check if the value is negative (i.e., the most significant bit is set)
|
|
946
965
|
const isNegative = (uint32Value & 0x80000000) !== 0 ? 1 : 0;
|
|
@@ -963,7 +982,7 @@ export function rfloat(_this, endian) {
|
|
|
963
982
|
}
|
|
964
983
|
return floatValue;
|
|
965
984
|
}
|
|
966
|
-
|
|
985
|
+
function wfloat(_this, value, endian) {
|
|
967
986
|
check_size(_this, 4, 0);
|
|
968
987
|
const maxValue = 3.402823466e+38;
|
|
969
988
|
const minValue = 1.175494351e-38;
|
|
@@ -985,7 +1004,7 @@ export function wfloat(_this, value, endian) {
|
|
|
985
1004
|
_this.offset += 4;
|
|
986
1005
|
_this.bitoffset = 0;
|
|
987
1006
|
}
|
|
988
|
-
|
|
1007
|
+
function rint64(_this, unsigned, endian) {
|
|
989
1008
|
check_size(_this, 8);
|
|
990
1009
|
// Convert the byte array to a BigInt
|
|
991
1010
|
let value = BigInt(0);
|
|
@@ -1015,7 +1034,7 @@ export function rint64(_this, unsigned, endian) {
|
|
|
1015
1034
|
_this.bitoffset = 0;
|
|
1016
1035
|
return value;
|
|
1017
1036
|
}
|
|
1018
|
-
|
|
1037
|
+
function wint64(_this, value, unsigned, endian) {
|
|
1019
1038
|
check_size(_this, 8, 0);
|
|
1020
1039
|
if (unsigned == true) {
|
|
1021
1040
|
if (value < 0 || value > Math.pow(2, 64) - 1) {
|
|
@@ -1069,7 +1088,7 @@ export function wint64(_this, value, unsigned, endian) {
|
|
|
1069
1088
|
_this.offset += 8;
|
|
1070
1089
|
_this.bitoffset = 0;
|
|
1071
1090
|
}
|
|
1072
|
-
|
|
1091
|
+
function wdfloat(_this, value, endian) {
|
|
1073
1092
|
check_size(_this, 8, 0);
|
|
1074
1093
|
const maxValue = 1.7976931348623158e308;
|
|
1075
1094
|
const minValue = 2.2250738585072014e-308;
|
|
@@ -1092,7 +1111,7 @@ export function wdfloat(_this, value, endian) {
|
|
|
1092
1111
|
_this.offset += 8;
|
|
1093
1112
|
_this.bitoffset = 0;
|
|
1094
1113
|
}
|
|
1095
|
-
|
|
1114
|
+
function rdfloat(_this, endian) {
|
|
1096
1115
|
var uint64Value = _this.readInt64(true, (endian == undefined ? _this.endian : endian));
|
|
1097
1116
|
const sign = (uint64Value & 0x8000000000000000n) >> 63n;
|
|
1098
1117
|
const exponent = Number((uint64Value & 0x7ff0000000000000n) >> 52n) - 1023;
|
|
@@ -1121,7 +1140,7 @@ export function rdfloat(_this, endian) {
|
|
|
1121
1140
|
}
|
|
1122
1141
|
return floatValue;
|
|
1123
1142
|
}
|
|
1124
|
-
|
|
1143
|
+
function rstring(_this, options) {
|
|
1125
1144
|
var length = options && options.length;
|
|
1126
1145
|
var stringType = options && options.stringType || 'utf-8';
|
|
1127
1146
|
var terminateValue = options && options.terminateValue;
|
|
@@ -1243,7 +1262,7 @@ export function rstring(_this, options) {
|
|
|
1243
1262
|
throw new Error('Unsupported string type: ' + stringType);
|
|
1244
1263
|
}
|
|
1245
1264
|
}
|
|
1246
|
-
|
|
1265
|
+
function wstring(_this, string, options) {
|
|
1247
1266
|
var length = options && options.length;
|
|
1248
1267
|
var stringType = options && options.stringType || 'utf-8';
|
|
1249
1268
|
var terminateValue = options && options.terminateValue;
|
|
@@ -1372,10 +1391,10 @@ export function wstring(_this, string, options) {
|
|
|
1372
1391
|
/**
|
|
1373
1392
|
* Binary reader, includes bitfields and strings
|
|
1374
1393
|
*
|
|
1375
|
-
* @param {Buffer|Uint8Array} data -
|
|
1394
|
+
* @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
|
|
1376
1395
|
* @param {number} byteOffset - Byte offset to start reader (default 0)
|
|
1377
1396
|
* @param {number} bitOffset - Bit offset 0-7 to start reader (default 0)
|
|
1378
|
-
* @param {string} endianness - Endianness
|
|
1397
|
+
* @param {string} endianness - Endianness ``big`` or ``little`` (default ``little``)
|
|
1379
1398
|
* @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default true)
|
|
1380
1399
|
*/
|
|
1381
1400
|
export class bireader {
|
|
@@ -1388,10 +1407,10 @@ export class bireader {
|
|
|
1388
1407
|
/**
|
|
1389
1408
|
* Binary reader, includes bitfields and strings
|
|
1390
1409
|
*
|
|
1391
|
-
* @param {Buffer|Uint8Array} data -
|
|
1410
|
+
* @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
|
|
1392
1411
|
* @param {number} byteOffset - Byte offset to start reader (default 0)
|
|
1393
1412
|
* @param {number} bitOffset - Bit offset 0-7 to start reader (default 0)
|
|
1394
|
-
* @param {string} endianness - Endianness
|
|
1413
|
+
* @param {string} endianness - Endianness ``big`` or ``little`` (default ``little``)
|
|
1395
1414
|
* @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default true)
|
|
1396
1415
|
*/
|
|
1397
1416
|
constructor(data, byteOffset, bitOffset, endianness, strict) {
|
|
@@ -1445,7 +1464,7 @@ export class bireader {
|
|
|
1445
1464
|
*
|
|
1446
1465
|
* Can be changed at any time, doesn't loose position
|
|
1447
1466
|
*
|
|
1448
|
-
* @param {string} endian - endianness
|
|
1467
|
+
* @param {string} endian - endianness ``big`` or ``little``
|
|
1449
1468
|
*/
|
|
1450
1469
|
endianness(endian) {
|
|
1451
1470
|
if (endian == undefined || typeof endian != "string") {
|
|
@@ -1496,6 +1515,26 @@ export class bireader {
|
|
|
1496
1515
|
// move from current position
|
|
1497
1516
|
//
|
|
1498
1517
|
/**
|
|
1518
|
+
* Aligns current byte position
|
|
1519
|
+
*
|
|
1520
|
+
* Note: Will extend array if strict mode is off and outside of max size
|
|
1521
|
+
*
|
|
1522
|
+
* @param {number} number - Byte to align
|
|
1523
|
+
*/
|
|
1524
|
+
align(number) {
|
|
1525
|
+
return align(this, number);
|
|
1526
|
+
}
|
|
1527
|
+
/**
|
|
1528
|
+
* Reverse aligns current byte position
|
|
1529
|
+
*
|
|
1530
|
+
* Note: Will extend array if strict mode is off and outside of max size
|
|
1531
|
+
*
|
|
1532
|
+
* @param {number} number - Byte to align
|
|
1533
|
+
*/
|
|
1534
|
+
alignRev(number) {
|
|
1535
|
+
return alignRev(this, number);
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1499
1538
|
* Offset current byte or bit position
|
|
1500
1539
|
* Note: Will extend array if strict mode is off and outside of max size
|
|
1501
1540
|
*
|
|
@@ -2052,7 +2091,7 @@ export class bireader {
|
|
|
2052
2091
|
* @param {number} endOffset - End location (default end of data)
|
|
2053
2092
|
* @param {boolean} consume - Move position to end of lifted data (default false)
|
|
2054
2093
|
* @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
|
|
2055
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
2094
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
2056
2095
|
*/
|
|
2057
2096
|
lift(startOffset, endOffset, consume, fillValue) {
|
|
2058
2097
|
return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
|
|
@@ -2064,7 +2103,7 @@ export class bireader {
|
|
|
2064
2103
|
* @param {number} endOffset - End location (default end of data)
|
|
2065
2104
|
* @param {boolean} consume - Move position to end of lifted data (default false)
|
|
2066
2105
|
* @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
|
|
2067
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
2106
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
2068
2107
|
*/
|
|
2069
2108
|
fill(startOffset, endOffset, consume, fillValue) {
|
|
2070
2109
|
return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
|
|
@@ -2075,7 +2114,7 @@ export class bireader {
|
|
|
2075
2114
|
*
|
|
2076
2115
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
2077
2116
|
* @param {number} consume - Moves offset to end of length
|
|
2078
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
2117
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
2079
2118
|
*/
|
|
2080
2119
|
extract(length, consume) {
|
|
2081
2120
|
return remove(this, this.offset, this.offset + (length || 0), consume || false, false);
|
|
@@ -2086,7 +2125,7 @@ export class bireader {
|
|
|
2086
2125
|
*
|
|
2087
2126
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
2088
2127
|
* @param {number} consume - Moves offset to end of length
|
|
2089
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
2128
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
2090
2129
|
*/
|
|
2091
2130
|
slice(length, consume) {
|
|
2092
2131
|
return remove(this, this.offset, this.offset + (length || 0), consume || false, false);
|
|
@@ -2097,7 +2136,7 @@ export class bireader {
|
|
|
2097
2136
|
*
|
|
2098
2137
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
2099
2138
|
* @param {number} consume - Moves offset to end of length
|
|
2100
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
2139
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
2101
2140
|
*/
|
|
2102
2141
|
wrap(length, consume) {
|
|
2103
2142
|
return remove(this, this.offset, this.offset + (length || 0), consume || false, false);
|
|
@@ -2109,7 +2148,7 @@ export class bireader {
|
|
|
2109
2148
|
* Inserts data into data
|
|
2110
2149
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2111
2150
|
*
|
|
2112
|
-
* @param {Buffer|Uint8Array} data -
|
|
2151
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
2113
2152
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
2114
2153
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
2115
2154
|
*/
|
|
@@ -2120,7 +2159,7 @@ export class bireader {
|
|
|
2120
2159
|
* Inserts data into data
|
|
2121
2160
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2122
2161
|
*
|
|
2123
|
-
* @param {Buffer|Uint8Array} data -
|
|
2162
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
2124
2163
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
2125
2164
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
2126
2165
|
*/
|
|
@@ -2131,7 +2170,7 @@ export class bireader {
|
|
|
2131
2170
|
* Replaces data in data
|
|
2132
2171
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2133
2172
|
*
|
|
2134
|
-
* @param {Buffer|Uint8Array} data -
|
|
2173
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
2135
2174
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
2136
2175
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
2137
2176
|
*/
|
|
@@ -2142,7 +2181,7 @@ export class bireader {
|
|
|
2142
2181
|
* Replaces data in data
|
|
2143
2182
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2144
2183
|
*
|
|
2145
|
-
* @param {Buffer|Uint8Array} data -
|
|
2184
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
2146
2185
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
2147
2186
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
2148
2187
|
*/
|
|
@@ -2153,7 +2192,7 @@ export class bireader {
|
|
|
2153
2192
|
* Adds data to start of supplied data
|
|
2154
2193
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2155
2194
|
*
|
|
2156
|
-
* @param {Buffer|Uint8Array} data -
|
|
2195
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
2157
2196
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
2158
2197
|
*/
|
|
2159
2198
|
unshift(data, consume) {
|
|
@@ -2163,7 +2202,7 @@ export class bireader {
|
|
|
2163
2202
|
* Adds data to start of supplied data
|
|
2164
2203
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2165
2204
|
*
|
|
2166
|
-
* @param {Buffer|Uint8Array} data -
|
|
2205
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
2167
2206
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
2168
2207
|
*/
|
|
2169
2208
|
prepend(data, consume) {
|
|
@@ -2173,7 +2212,7 @@ export class bireader {
|
|
|
2173
2212
|
* Adds data to end of supplied data
|
|
2174
2213
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2175
2214
|
*
|
|
2176
|
-
* @param {Buffer|Uint8Array} data -
|
|
2215
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
2177
2216
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
2178
2217
|
*/
|
|
2179
2218
|
push(data, consume) {
|
|
@@ -2183,7 +2222,7 @@ export class bireader {
|
|
|
2183
2222
|
* Adds data to end of supplied data
|
|
2184
2223
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
2185
2224
|
*
|
|
2186
|
-
* @param {Buffer|Uint8Array} data -
|
|
2225
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
2187
2226
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
2188
2227
|
*/
|
|
2189
2228
|
append(data, consume) {
|
|
@@ -2283,7 +2322,7 @@ export class bireader {
|
|
|
2283
2322
|
*
|
|
2284
2323
|
* @param {number} bits - bits to read
|
|
2285
2324
|
* @param {boolean} unsigned - if the value is unsigned
|
|
2286
|
-
* @param {string} endian - ``big`` or ``little
|
|
2325
|
+
* @param {string} endian - ``big`` or ``little``
|
|
2287
2326
|
* @returns number
|
|
2288
2327
|
*/
|
|
2289
2328
|
readBit(bits, unsigned, endian) {
|
|
@@ -2296,7 +2335,7 @@ export class bireader {
|
|
|
2296
2335
|
*
|
|
2297
2336
|
* @param {number} bits - bits to read
|
|
2298
2337
|
* @param {boolean} unsigned - if the value is unsigned
|
|
2299
|
-
* @param {string} endian - ``big`` or ``little
|
|
2338
|
+
* @param {string} endian - ``big`` or ``little``
|
|
2300
2339
|
* @returns number
|
|
2301
2340
|
*/
|
|
2302
2341
|
bit(bits, unsigned, endian) {
|
|
@@ -2308,7 +2347,7 @@ export class bireader {
|
|
|
2308
2347
|
* Note: When returning to a byte read, remaining bits are dropped
|
|
2309
2348
|
*
|
|
2310
2349
|
* @param {number} bits - bits to read
|
|
2311
|
-
* @param {string} endian - ``big`` or ``little
|
|
2350
|
+
* @param {string} endian - ``big`` or ``little``
|
|
2312
2351
|
* @returns number
|
|
2313
2352
|
*/
|
|
2314
2353
|
ubit(bits, endian) {
|
|
@@ -2320,7 +2359,7 @@ export class bireader {
|
|
|
2320
2359
|
* Note: When returning to a byte read, remaining bits are dropped
|
|
2321
2360
|
*
|
|
2322
2361
|
* @param {boolean} unsigned - if the value is unsigned
|
|
2323
|
-
* @param {string} endian - ``big`` or ``little
|
|
2362
|
+
* @param {string} endian - ``big`` or ``little``
|
|
2324
2363
|
* @returns number
|
|
2325
2364
|
*/
|
|
2326
2365
|
bit1(unsigned, endian) {
|
|
@@ -4445,6 +4484,14 @@ export class bireader {
|
|
|
4445
4484
|
return wbyte(this, value, unsigned);
|
|
4446
4485
|
}
|
|
4447
4486
|
/**
|
|
4487
|
+
* Write unsigned byte
|
|
4488
|
+
*
|
|
4489
|
+
* @param {number} value - value as int
|
|
4490
|
+
*/
|
|
4491
|
+
writeUByte(value) {
|
|
4492
|
+
return wbyte(this, value, true);
|
|
4493
|
+
}
|
|
4494
|
+
/**
|
|
4448
4495
|
* Read byte
|
|
4449
4496
|
*
|
|
4450
4497
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
@@ -4493,7 +4540,7 @@ export class bireader {
|
|
|
4493
4540
|
* Read short
|
|
4494
4541
|
*
|
|
4495
4542
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4496
|
-
* @param {string} endian -
|
|
4543
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4497
4544
|
* @returns number
|
|
4498
4545
|
*/
|
|
4499
4546
|
readInt16(unsigned, endian) {
|
|
@@ -4504,16 +4551,25 @@ export class bireader {
|
|
|
4504
4551
|
*
|
|
4505
4552
|
* @param {number} value - value as int
|
|
4506
4553
|
* @param {boolean} unsigned - if the value is unsigned
|
|
4507
|
-
* @param {string} endian - ``big`` or ``little
|
|
4554
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4508
4555
|
*/
|
|
4509
4556
|
writeInt16(value, unsigned, endian) {
|
|
4510
4557
|
return wint16(this, value, unsigned, endian);
|
|
4511
4558
|
}
|
|
4512
4559
|
/**
|
|
4560
|
+
* Write unsigned int16
|
|
4561
|
+
*
|
|
4562
|
+
* @param {number} value - value as int
|
|
4563
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4564
|
+
*/
|
|
4565
|
+
writeUInt16(value, endian) {
|
|
4566
|
+
return wint16(this, value, true, endian);
|
|
4567
|
+
}
|
|
4568
|
+
/**
|
|
4513
4569
|
* Read short
|
|
4514
4570
|
*
|
|
4515
4571
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4516
|
-
* @param {string} endian -
|
|
4572
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4517
4573
|
* @returns number
|
|
4518
4574
|
*/
|
|
4519
4575
|
int16(unsigned, endian) {
|
|
@@ -4523,7 +4579,7 @@ export class bireader {
|
|
|
4523
4579
|
* Read short
|
|
4524
4580
|
*
|
|
4525
4581
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4526
|
-
* @param {string} endian -
|
|
4582
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4527
4583
|
* @returns number
|
|
4528
4584
|
*/
|
|
4529
4585
|
short(unsigned, endian) {
|
|
@@ -4533,7 +4589,7 @@ export class bireader {
|
|
|
4533
4589
|
* Read short
|
|
4534
4590
|
*
|
|
4535
4591
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4536
|
-
* @param {string} endian -
|
|
4592
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4537
4593
|
* @returns number
|
|
4538
4594
|
*/
|
|
4539
4595
|
word(unsigned, endian) {
|
|
@@ -4542,7 +4598,7 @@ export class bireader {
|
|
|
4542
4598
|
/**
|
|
4543
4599
|
* Read unsigned short
|
|
4544
4600
|
*
|
|
4545
|
-
* @param {string} endian -
|
|
4601
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4546
4602
|
*
|
|
4547
4603
|
* @returns number
|
|
4548
4604
|
*/
|
|
@@ -4552,7 +4608,7 @@ export class bireader {
|
|
|
4552
4608
|
/**
|
|
4553
4609
|
* Read unsigned short
|
|
4554
4610
|
*
|
|
4555
|
-
* @param {string} endian -
|
|
4611
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4556
4612
|
*
|
|
4557
4613
|
* @returns number
|
|
4558
4614
|
*/
|
|
@@ -4562,7 +4618,7 @@ export class bireader {
|
|
|
4562
4618
|
/**
|
|
4563
4619
|
* Read unsigned short
|
|
4564
4620
|
*
|
|
4565
|
-
* @param {string} endian -
|
|
4621
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4566
4622
|
*
|
|
4567
4623
|
* @returns number
|
|
4568
4624
|
*/
|
|
@@ -4572,7 +4628,7 @@ export class bireader {
|
|
|
4572
4628
|
/**
|
|
4573
4629
|
* Read unsigned short
|
|
4574
4630
|
*
|
|
4575
|
-
* @param {string} endian -
|
|
4631
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4576
4632
|
*
|
|
4577
4633
|
* @returns number
|
|
4578
4634
|
*/
|
|
@@ -4713,7 +4769,7 @@ export class bireader {
|
|
|
4713
4769
|
/**
|
|
4714
4770
|
* Read half float
|
|
4715
4771
|
*
|
|
4716
|
-
* @param {string} endian -
|
|
4772
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4717
4773
|
* @returns number
|
|
4718
4774
|
*/
|
|
4719
4775
|
readHalfFloat(endian) {
|
|
@@ -4723,7 +4779,7 @@ export class bireader {
|
|
|
4723
4779
|
* Writes half float
|
|
4724
4780
|
*
|
|
4725
4781
|
* @param {number} value - value as int
|
|
4726
|
-
* @param {string} endian - ``big`` or ``little
|
|
4782
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4727
4783
|
*/
|
|
4728
4784
|
writeHalfFloat(value, endian) {
|
|
4729
4785
|
return whalffloat(this, value, endian);
|
|
@@ -4731,7 +4787,7 @@ export class bireader {
|
|
|
4731
4787
|
/**
|
|
4732
4788
|
* Read half float
|
|
4733
4789
|
*
|
|
4734
|
-
* @param {string} endian -
|
|
4790
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4735
4791
|
* @returns number
|
|
4736
4792
|
*/
|
|
4737
4793
|
halffloat(endian) {
|
|
@@ -4740,7 +4796,7 @@ export class bireader {
|
|
|
4740
4796
|
/**
|
|
4741
4797
|
* Read half float
|
|
4742
4798
|
*
|
|
4743
|
-
* @param {string} endian -
|
|
4799
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4744
4800
|
* @returns number
|
|
4745
4801
|
*/
|
|
4746
4802
|
half(endian) {
|
|
@@ -4801,7 +4857,7 @@ export class bireader {
|
|
|
4801
4857
|
* Read 32 bit integer
|
|
4802
4858
|
*
|
|
4803
4859
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4804
|
-
* @param {string} endian -
|
|
4860
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4805
4861
|
* @returns number
|
|
4806
4862
|
*/
|
|
4807
4863
|
readInt32(unsigned, endian) {
|
|
@@ -4812,16 +4868,25 @@ export class bireader {
|
|
|
4812
4868
|
*
|
|
4813
4869
|
* @param {number} value - value as int
|
|
4814
4870
|
* @param {boolean} unsigned - if the value is unsigned
|
|
4815
|
-
* @param {string} endian - ``big`` or ``little
|
|
4871
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4816
4872
|
*/
|
|
4817
4873
|
writeInt32(value, unsigned, endian) {
|
|
4818
4874
|
return wint32(this, value, unsigned, endian);
|
|
4819
4875
|
}
|
|
4820
4876
|
/**
|
|
4877
|
+
* Write unsigned int32
|
|
4878
|
+
*
|
|
4879
|
+
* @param {number} value - value as int
|
|
4880
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4881
|
+
*/
|
|
4882
|
+
writeUInt32(value, endian) {
|
|
4883
|
+
return wint32(this, value, true, endian);
|
|
4884
|
+
}
|
|
4885
|
+
/**
|
|
4821
4886
|
* Read 32 bit integer
|
|
4822
4887
|
*
|
|
4823
4888
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4824
|
-
* @param {string} endian -
|
|
4889
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4825
4890
|
* @returns number
|
|
4826
4891
|
*/
|
|
4827
4892
|
int(unsigned, endian) {
|
|
@@ -4831,7 +4896,7 @@ export class bireader {
|
|
|
4831
4896
|
* Read 32 bit integer
|
|
4832
4897
|
*
|
|
4833
4898
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4834
|
-
* @param {string} endian -
|
|
4899
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4835
4900
|
* @returns number
|
|
4836
4901
|
*/
|
|
4837
4902
|
double(unsigned, endian) {
|
|
@@ -4841,7 +4906,7 @@ export class bireader {
|
|
|
4841
4906
|
* Read 32 bit integer
|
|
4842
4907
|
*
|
|
4843
4908
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4844
|
-
* @param {string} endian -
|
|
4909
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4845
4910
|
* @returns number
|
|
4846
4911
|
*/
|
|
4847
4912
|
int32(unsigned, endian) {
|
|
@@ -4851,7 +4916,7 @@ export class bireader {
|
|
|
4851
4916
|
* Read 32 bit integer
|
|
4852
4917
|
*
|
|
4853
4918
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
4854
|
-
* @param {string} endian -
|
|
4919
|
+
* @param {string} endian - ``big`` or ``little``
|
|
4855
4920
|
* @returns number
|
|
4856
4921
|
*/
|
|
4857
4922
|
long(unsigned, endian) {
|
|
@@ -5063,25 +5128,25 @@ export class bireader {
|
|
|
5063
5128
|
/**
|
|
5064
5129
|
* Read float
|
|
5065
5130
|
*
|
|
5066
|
-
* @param {string} endian -
|
|
5131
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5067
5132
|
* @returns number
|
|
5068
5133
|
*/
|
|
5069
5134
|
readFloat(endian) {
|
|
5070
5135
|
return rfloat(this, endian);
|
|
5071
5136
|
}
|
|
5072
5137
|
/**
|
|
5073
|
-
|
|
5074
|
-
|
|
5075
|
-
|
|
5076
|
-
|
|
5077
|
-
|
|
5138
|
+
* Write float
|
|
5139
|
+
*
|
|
5140
|
+
* @param {number} value - value as int
|
|
5141
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5142
|
+
*/
|
|
5078
5143
|
writeFloat(value, endian) {
|
|
5079
5144
|
return wfloat(this, value, endian);
|
|
5080
5145
|
}
|
|
5081
5146
|
/**
|
|
5082
5147
|
* Read float
|
|
5083
5148
|
*
|
|
5084
|
-
* @param {string} endian -
|
|
5149
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5085
5150
|
* @returns number
|
|
5086
5151
|
*/
|
|
5087
5152
|
float(endian) {
|
|
@@ -5125,7 +5190,7 @@ export class bireader {
|
|
|
5125
5190
|
/**
|
|
5126
5191
|
* Read signed 64 bit integer
|
|
5127
5192
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
5128
|
-
* @param {string} endian -
|
|
5193
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5129
5194
|
* @returns number
|
|
5130
5195
|
*/
|
|
5131
5196
|
readInt64(unsigned, endian) {
|
|
@@ -5136,7 +5201,7 @@ export class bireader {
|
|
|
5136
5201
|
*
|
|
5137
5202
|
* @param {number} value - value as int
|
|
5138
5203
|
* @param {boolean} unsigned - if the value is unsigned
|
|
5139
|
-
* @param {string} endian - ``big`` or ``little
|
|
5204
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5140
5205
|
*/
|
|
5141
5206
|
writeInt64(value, unsigned, endian) {
|
|
5142
5207
|
return wint64(this, value, unsigned, endian);
|
|
@@ -5144,7 +5209,7 @@ export class bireader {
|
|
|
5144
5209
|
/**
|
|
5145
5210
|
* Read signed 64 bit integer
|
|
5146
5211
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
5147
|
-
* @param {string} endian -
|
|
5212
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5148
5213
|
* @returns number
|
|
5149
5214
|
*/
|
|
5150
5215
|
int64(unsigned, endian) {
|
|
@@ -5153,7 +5218,7 @@ export class bireader {
|
|
|
5153
5218
|
/**
|
|
5154
5219
|
* Read signed 64 bit integer
|
|
5155
5220
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
5156
|
-
* @param {string} endian -
|
|
5221
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5157
5222
|
* @returns number
|
|
5158
5223
|
*/
|
|
5159
5224
|
bigint(unsigned, endian) {
|
|
@@ -5162,7 +5227,7 @@ export class bireader {
|
|
|
5162
5227
|
/**
|
|
5163
5228
|
* Read signed 64 bit integer
|
|
5164
5229
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
5165
|
-
* @param {string} endian -
|
|
5230
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5166
5231
|
* @returns number
|
|
5167
5232
|
*/
|
|
5168
5233
|
quad(unsigned, endian) {
|
|
@@ -5334,7 +5399,7 @@ export class bireader {
|
|
|
5334
5399
|
/**
|
|
5335
5400
|
* Read double float
|
|
5336
5401
|
*
|
|
5337
|
-
* @param {string} endian -
|
|
5402
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5338
5403
|
* @returns number
|
|
5339
5404
|
*/
|
|
5340
5405
|
readDoubleFloat(endian) {
|
|
@@ -5345,7 +5410,7 @@ export class bireader {
|
|
|
5345
5410
|
*
|
|
5346
5411
|
* @param {number} value - value as int
|
|
5347
5412
|
* @param {number} offset - byte offset (default last write position)
|
|
5348
|
-
* @param {string} endian - ``big`` or ``little
|
|
5413
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5349
5414
|
*/
|
|
5350
5415
|
writeDoubleFloat(value, endian) {
|
|
5351
5416
|
return wdfloat(this, value, endian);
|
|
@@ -5353,7 +5418,7 @@ export class bireader {
|
|
|
5353
5418
|
/**
|
|
5354
5419
|
* Read double float
|
|
5355
5420
|
*
|
|
5356
|
-
* @param {string} endian -
|
|
5421
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5357
5422
|
* @returns number
|
|
5358
5423
|
*/
|
|
5359
5424
|
doublefloat(endian) {
|
|
@@ -5362,7 +5427,7 @@ export class bireader {
|
|
|
5362
5427
|
/**
|
|
5363
5428
|
* Read double float
|
|
5364
5429
|
*
|
|
5365
|
-
* @param {string} endian -
|
|
5430
|
+
* @param {string} endian - ``big`` or ``little``
|
|
5366
5431
|
* @returns number
|
|
5367
5432
|
*/
|
|
5368
5433
|
dfloat(endian) {
|
|
@@ -5855,7 +5920,7 @@ export class biwriter {
|
|
|
5855
5920
|
*
|
|
5856
5921
|
* Can be changed at any time, doesn't loose position
|
|
5857
5922
|
*
|
|
5858
|
-
* @param {string} endian - Endianness
|
|
5923
|
+
* @param {string} endian - Endianness ``big`` or ``little``
|
|
5859
5924
|
*/
|
|
5860
5925
|
endianness(endian) {
|
|
5861
5926
|
if (endian == undefined || typeof endian != "string") {
|
|
@@ -5912,7 +5977,28 @@ export class biwriter {
|
|
|
5912
5977
|
// move from current position
|
|
5913
5978
|
//
|
|
5914
5979
|
/**
|
|
5980
|
+
* Aligns current byte position
|
|
5981
|
+
*
|
|
5982
|
+
* Note: Will extend array if strict mode is off and outside of max size
|
|
5983
|
+
*
|
|
5984
|
+
* @param {number} number - Byte to align
|
|
5985
|
+
*/
|
|
5986
|
+
align(number) {
|
|
5987
|
+
return align(this, number);
|
|
5988
|
+
}
|
|
5989
|
+
/**
|
|
5990
|
+
* Reverse aligns current byte position
|
|
5991
|
+
*
|
|
5992
|
+
* Note: Will extend array if strict mode is off and outside of max size
|
|
5993
|
+
*
|
|
5994
|
+
* @param {number} number - Byte to align
|
|
5995
|
+
*/
|
|
5996
|
+
alignRev(number) {
|
|
5997
|
+
return alignRev(this, number);
|
|
5998
|
+
}
|
|
5999
|
+
/**
|
|
5915
6000
|
* Offset current byte or bit position
|
|
6001
|
+
*
|
|
5916
6002
|
* Note: Will extend array if strict mode is off and outside of max size
|
|
5917
6003
|
*
|
|
5918
6004
|
* @param {number} bytes - Bytes to skip
|
|
@@ -6468,7 +6554,7 @@ export class biwriter {
|
|
|
6468
6554
|
* @param {number} endOffset - End location (default end of data)
|
|
6469
6555
|
* @param {boolean} consume - Move position to end of lifted data (default false)
|
|
6470
6556
|
* @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
|
|
6471
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
6557
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
6472
6558
|
*/
|
|
6473
6559
|
lift(startOffset, endOffset, consume, fillValue) {
|
|
6474
6560
|
return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
|
|
@@ -6480,7 +6566,7 @@ export class biwriter {
|
|
|
6480
6566
|
* @param {number} endOffset - End location (default end of data)
|
|
6481
6567
|
* @param {boolean} consume - Move position to end of lifted data (default false)
|
|
6482
6568
|
* @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
|
|
6483
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
6569
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
6484
6570
|
*/
|
|
6485
6571
|
fill(startOffset, endOffset, consume, fillValue) {
|
|
6486
6572
|
return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
|
|
@@ -6491,7 +6577,7 @@ export class biwriter {
|
|
|
6491
6577
|
*
|
|
6492
6578
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
6493
6579
|
* @param {number} consume - Moves offset to end of length
|
|
6494
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
6580
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
6495
6581
|
*/
|
|
6496
6582
|
extract(length, consume) {
|
|
6497
6583
|
return remove(this, this.offset, this.offset + (length || 0), consume || false, false);
|
|
@@ -6502,7 +6588,7 @@ export class biwriter {
|
|
|
6502
6588
|
*
|
|
6503
6589
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
6504
6590
|
* @param {number} consume - Moves offset to end of length
|
|
6505
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
6591
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
6506
6592
|
*/
|
|
6507
6593
|
slice(length, consume) {
|
|
6508
6594
|
return remove(this, this.offset, this.offset + (length || 0), consume || false, false);
|
|
@@ -6513,7 +6599,7 @@ export class biwriter {
|
|
|
6513
6599
|
*
|
|
6514
6600
|
* @param {number} length - Length of data in bytes to copy from current offset
|
|
6515
6601
|
* @param {number} consume - Moves offset to end of length
|
|
6516
|
-
* @returns {Buffer|Uint8Array} Selected data as
|
|
6602
|
+
* @returns {Buffer|Uint8Array} Selected data as ``Uint8Array`` or ``Buffer``
|
|
6517
6603
|
*/
|
|
6518
6604
|
wrap(length, consume) {
|
|
6519
6605
|
return remove(this, this.offset, this.offset + (length || 0), consume || false, false);
|
|
@@ -6525,7 +6611,7 @@ export class biwriter {
|
|
|
6525
6611
|
* Inserts data into data
|
|
6526
6612
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6527
6613
|
*
|
|
6528
|
-
* @param {Buffer|Uint8Array} data -
|
|
6614
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
6529
6615
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
6530
6616
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
6531
6617
|
*/
|
|
@@ -6536,7 +6622,7 @@ export class biwriter {
|
|
|
6536
6622
|
* Inserts data into data
|
|
6537
6623
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6538
6624
|
*
|
|
6539
|
-
* @param {Buffer|Uint8Array} data -
|
|
6625
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
6540
6626
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
6541
6627
|
* @param {number} offset - Byte position to add at (defaults to current position)
|
|
6542
6628
|
*/
|
|
@@ -6547,7 +6633,7 @@ export class biwriter {
|
|
|
6547
6633
|
* Replaces data in data
|
|
6548
6634
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6549
6635
|
*
|
|
6550
|
-
* @param {Buffer|Uint8Array} data -
|
|
6636
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
6551
6637
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
6552
6638
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
6553
6639
|
*/
|
|
@@ -6558,7 +6644,7 @@ export class biwriter {
|
|
|
6558
6644
|
* Replaces data in data
|
|
6559
6645
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6560
6646
|
*
|
|
6561
|
-
* @param {Buffer|Uint8Array} data -
|
|
6647
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to replace in data
|
|
6562
6648
|
* @param {boolean} consume - Move current byte position to end of data (default false)
|
|
6563
6649
|
* @param {number} offset - Offset to add it at (defaults to current position)
|
|
6564
6650
|
*/
|
|
@@ -6569,7 +6655,7 @@ export class biwriter {
|
|
|
6569
6655
|
* Adds data to start of supplied data
|
|
6570
6656
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6571
6657
|
*
|
|
6572
|
-
* @param {Buffer|Uint8Array} data -
|
|
6658
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
6573
6659
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
6574
6660
|
*/
|
|
6575
6661
|
unshift(data, consume) {
|
|
@@ -6579,7 +6665,7 @@ export class biwriter {
|
|
|
6579
6665
|
* Adds data to start of supplied data
|
|
6580
6666
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6581
6667
|
*
|
|
6582
|
-
* @param {Buffer|Uint8Array} data -
|
|
6668
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
6583
6669
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
6584
6670
|
*/
|
|
6585
6671
|
prepend(data, consume) {
|
|
@@ -6589,7 +6675,7 @@ export class biwriter {
|
|
|
6589
6675
|
* Adds data to end of supplied data
|
|
6590
6676
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6591
6677
|
*
|
|
6592
|
-
* @param {Buffer|Uint8Array} data -
|
|
6678
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
6593
6679
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
6594
6680
|
*/
|
|
6595
6681
|
push(data, consume) {
|
|
@@ -6599,7 +6685,7 @@ export class biwriter {
|
|
|
6599
6685
|
* Adds data to end of supplied data
|
|
6600
6686
|
* Note: Must be same data type as supplied data. Errors on strict mode.
|
|
6601
6687
|
*
|
|
6602
|
-
* @param {Buffer|Uint8Array} data -
|
|
6688
|
+
* @param {Buffer|Uint8Array} data - ``Uint8Array`` or ``Buffer`` to add to data
|
|
6603
6689
|
* @param {boolean} consume - Move current write position to end of data (default false)
|
|
6604
6690
|
*/
|
|
6605
6691
|
append(data, consume) {
|
|
@@ -6699,7 +6785,7 @@ export class biwriter {
|
|
|
6699
6785
|
*
|
|
6700
6786
|
* @param {number} bits - bits to read
|
|
6701
6787
|
* @param {boolean} unsigned - if the value is unsigned
|
|
6702
|
-
* @param {string} endian - ``big`` or ``little
|
|
6788
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6703
6789
|
* @returns number
|
|
6704
6790
|
*/
|
|
6705
6791
|
readBit(bits, unsigned, endian) {
|
|
@@ -6713,7 +6799,7 @@ export class biwriter {
|
|
|
6713
6799
|
* @param {number} value - value as int
|
|
6714
6800
|
* @param {number} bits - bits to write
|
|
6715
6801
|
* @param {boolean} unsigned - if the value is unsigned
|
|
6716
|
-
* @param {string} endian - ``big`` or ``little
|
|
6802
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6717
6803
|
* @returns number
|
|
6718
6804
|
*/
|
|
6719
6805
|
bit(value, bits, unsigned, endian) {
|
|
@@ -6726,7 +6812,7 @@ export class biwriter {
|
|
|
6726
6812
|
*
|
|
6727
6813
|
* @param {number} value - value as int
|
|
6728
6814
|
* @param {number} bits - bits to write
|
|
6729
|
-
* @param {string} endian - ``big`` or ``little
|
|
6815
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6730
6816
|
* @returns number
|
|
6731
6817
|
*/
|
|
6732
6818
|
ubit(value, bits, endian) {
|
|
@@ -6839,7 +6925,7 @@ export class biwriter {
|
|
|
6839
6925
|
*
|
|
6840
6926
|
* @param {number} value - value as int
|
|
6841
6927
|
* @param {boolean} unsigned - if the value is unsigned
|
|
6842
|
-
* @param {string} endian - ``big`` or ``little
|
|
6928
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6843
6929
|
* @returns number
|
|
6844
6930
|
*/
|
|
6845
6931
|
bit1(value, unsigned, endian) {
|
|
@@ -6875,7 +6961,7 @@ export class biwriter {
|
|
|
6875
6961
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
6876
6962
|
*
|
|
6877
6963
|
* @param {number} value - value as int
|
|
6878
|
-
* @param {string} endian - ``big`` or ``little
|
|
6964
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6879
6965
|
* @returns number
|
|
6880
6966
|
*/
|
|
6881
6967
|
ubit1(value, endian) {
|
|
@@ -6910,7 +6996,7 @@ export class biwriter {
|
|
|
6910
6996
|
*
|
|
6911
6997
|
* @param {number} value - value as int
|
|
6912
6998
|
* @param {boolean} unsigned - if the value is unsigned
|
|
6913
|
-
* @param {string} endian - ``big`` or ``little
|
|
6999
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6914
7000
|
* @returns number
|
|
6915
7001
|
*/
|
|
6916
7002
|
bit2(value, unsigned, endian) {
|
|
@@ -6946,7 +7032,7 @@ export class biwriter {
|
|
|
6946
7032
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
6947
7033
|
*
|
|
6948
7034
|
* @param {number} value - value as int
|
|
6949
|
-
* @param {string} endian - ``big`` or ``little
|
|
7035
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6950
7036
|
* @returns number
|
|
6951
7037
|
*/
|
|
6952
7038
|
ubit2(value, endian) {
|
|
@@ -6981,7 +7067,7 @@ export class biwriter {
|
|
|
6981
7067
|
*
|
|
6982
7068
|
* @param {number} value - value as int
|
|
6983
7069
|
* @param {boolean} unsigned - if the value is unsigned
|
|
6984
|
-
* @param {string} endian - ``big`` or ``little
|
|
7070
|
+
* @param {string} endian - ``big`` or ``little``
|
|
6985
7071
|
* @returns number
|
|
6986
7072
|
*/
|
|
6987
7073
|
bit3(value, unsigned, endian) {
|
|
@@ -7017,7 +7103,7 @@ export class biwriter {
|
|
|
7017
7103
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7018
7104
|
*
|
|
7019
7105
|
* @param {number} value - value as int
|
|
7020
|
-
* @param {string} endian - ``big`` or ``little
|
|
7106
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7021
7107
|
* @returns number
|
|
7022
7108
|
*/
|
|
7023
7109
|
ubit3(value, endian) {
|
|
@@ -7052,7 +7138,7 @@ export class biwriter {
|
|
|
7052
7138
|
*
|
|
7053
7139
|
* @param {number} value - value as int
|
|
7054
7140
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7055
|
-
* @param {string} endian - ``big`` or ``little
|
|
7141
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7056
7142
|
* @returns number
|
|
7057
7143
|
*/
|
|
7058
7144
|
bit4(value, unsigned, endian) {
|
|
@@ -7088,7 +7174,7 @@ export class biwriter {
|
|
|
7088
7174
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7089
7175
|
*
|
|
7090
7176
|
* @param {number} value - value as int
|
|
7091
|
-
* @param {string} endian - ``big`` or ``little
|
|
7177
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7092
7178
|
* @returns number
|
|
7093
7179
|
*/
|
|
7094
7180
|
ubit4(value, endian) {
|
|
@@ -7123,7 +7209,7 @@ export class biwriter {
|
|
|
7123
7209
|
*
|
|
7124
7210
|
* @param {number} value - value as int
|
|
7125
7211
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7126
|
-
* @param {string} endian - ``big`` or ``little
|
|
7212
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7127
7213
|
* @returns number
|
|
7128
7214
|
*/
|
|
7129
7215
|
bit5(value, unsigned, endian) {
|
|
@@ -7159,7 +7245,7 @@ export class biwriter {
|
|
|
7159
7245
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7160
7246
|
*
|
|
7161
7247
|
* @param {number} value - value as int
|
|
7162
|
-
* @param {string} endian - ``big`` or ``little
|
|
7248
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7163
7249
|
* @returns number
|
|
7164
7250
|
*/
|
|
7165
7251
|
ubit5(value, endian) {
|
|
@@ -7194,7 +7280,7 @@ export class biwriter {
|
|
|
7194
7280
|
*
|
|
7195
7281
|
* @param {number} value - value as int
|
|
7196
7282
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7197
|
-
* @param {string} endian - ``big`` or ``little
|
|
7283
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7198
7284
|
* @returns number
|
|
7199
7285
|
*/
|
|
7200
7286
|
bit6(value, unsigned, endian) {
|
|
@@ -7230,7 +7316,7 @@ export class biwriter {
|
|
|
7230
7316
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7231
7317
|
*
|
|
7232
7318
|
* @param {number} value - value as int
|
|
7233
|
-
* @param {string} endian - ``big`` or ``little
|
|
7319
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7234
7320
|
* @returns number
|
|
7235
7321
|
*/
|
|
7236
7322
|
ubit6(value, endian) {
|
|
@@ -7265,7 +7351,7 @@ export class biwriter {
|
|
|
7265
7351
|
*
|
|
7266
7352
|
* @param {number} value - value as int
|
|
7267
7353
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7268
|
-
* @param {string} endian - ``big`` or ``little
|
|
7354
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7269
7355
|
* @returns number
|
|
7270
7356
|
*/
|
|
7271
7357
|
bit7(value, unsigned, endian) {
|
|
@@ -7301,7 +7387,7 @@ export class biwriter {
|
|
|
7301
7387
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7302
7388
|
*
|
|
7303
7389
|
* @param {number} value - value as int
|
|
7304
|
-
* @param {string} endian - ``big`` or ``little
|
|
7390
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7305
7391
|
* @returns number
|
|
7306
7392
|
*/
|
|
7307
7393
|
ubit7(value, endian) {
|
|
@@ -7336,7 +7422,7 @@ export class biwriter {
|
|
|
7336
7422
|
*
|
|
7337
7423
|
* @param {number} value - value as int
|
|
7338
7424
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7339
|
-
* @param {string} endian - ``big`` or ``little
|
|
7425
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7340
7426
|
* @returns number
|
|
7341
7427
|
*/
|
|
7342
7428
|
bit8(value, unsigned, endian) {
|
|
@@ -7372,7 +7458,7 @@ export class biwriter {
|
|
|
7372
7458
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7373
7459
|
*
|
|
7374
7460
|
* @param {number} value - value as int
|
|
7375
|
-
* @param {string} endian - ``big`` or ``little
|
|
7461
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7376
7462
|
* @returns number
|
|
7377
7463
|
*/
|
|
7378
7464
|
ubit8(value, endian) {
|
|
@@ -7407,7 +7493,7 @@ export class biwriter {
|
|
|
7407
7493
|
*
|
|
7408
7494
|
* @param {number} value - value as int
|
|
7409
7495
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7410
|
-
* @param {string} endian - ``big`` or ``little
|
|
7496
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7411
7497
|
* @returns number
|
|
7412
7498
|
*/
|
|
7413
7499
|
bit9(value, unsigned, endian) {
|
|
@@ -7443,7 +7529,7 @@ export class biwriter {
|
|
|
7443
7529
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7444
7530
|
*
|
|
7445
7531
|
* @param {number} value - value as int
|
|
7446
|
-
* @param {string} endian - ``big`` or ``little
|
|
7532
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7447
7533
|
* @returns number
|
|
7448
7534
|
*/
|
|
7449
7535
|
ubit9(value, endian) {
|
|
@@ -7478,7 +7564,7 @@ export class biwriter {
|
|
|
7478
7564
|
*
|
|
7479
7565
|
* @param {number} value - value as int
|
|
7480
7566
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7481
|
-
* @param {string} endian - ``big`` or ``little
|
|
7567
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7482
7568
|
* @returns number
|
|
7483
7569
|
*/
|
|
7484
7570
|
bit10(value, unsigned, endian) {
|
|
@@ -7514,7 +7600,7 @@ export class biwriter {
|
|
|
7514
7600
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7515
7601
|
*
|
|
7516
7602
|
* @param {number} value - value as int
|
|
7517
|
-
* @param {string} endian - ``big`` or ``little
|
|
7603
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7518
7604
|
* @returns number
|
|
7519
7605
|
*/
|
|
7520
7606
|
ubit10(value, endian) {
|
|
@@ -7549,7 +7635,7 @@ export class biwriter {
|
|
|
7549
7635
|
*
|
|
7550
7636
|
* @param {number} value - value as int
|
|
7551
7637
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7552
|
-
* @param {string} endian - ``big`` or ``little
|
|
7638
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7553
7639
|
* @returns number
|
|
7554
7640
|
*/
|
|
7555
7641
|
bit11(value, unsigned, endian) {
|
|
@@ -7585,7 +7671,7 @@ export class biwriter {
|
|
|
7585
7671
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7586
7672
|
*
|
|
7587
7673
|
* @param {number} value - value as int
|
|
7588
|
-
* @param {string} endian - ``big`` or ``little
|
|
7674
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7589
7675
|
* @returns number
|
|
7590
7676
|
*/
|
|
7591
7677
|
ubit11(value, endian) {
|
|
@@ -7620,7 +7706,7 @@ export class biwriter {
|
|
|
7620
7706
|
*
|
|
7621
7707
|
* @param {number} value - value as int
|
|
7622
7708
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7623
|
-
* @param {string} endian - ``big`` or ``little
|
|
7709
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7624
7710
|
* @returns number
|
|
7625
7711
|
*/
|
|
7626
7712
|
bit12(value, unsigned, endian) {
|
|
@@ -7656,7 +7742,7 @@ export class biwriter {
|
|
|
7656
7742
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7657
7743
|
*
|
|
7658
7744
|
* @param {number} value - value as int
|
|
7659
|
-
* @param {string} endian - ``big`` or ``little
|
|
7745
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7660
7746
|
* @returns number
|
|
7661
7747
|
*/
|
|
7662
7748
|
ubit12(value, endian) {
|
|
@@ -7691,7 +7777,7 @@ export class biwriter {
|
|
|
7691
7777
|
*
|
|
7692
7778
|
* @param {number} value - value as int
|
|
7693
7779
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7694
|
-
* @param {string} endian - ``big`` or ``little
|
|
7780
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7695
7781
|
* @returns number
|
|
7696
7782
|
*/
|
|
7697
7783
|
bit13(value, unsigned, endian) {
|
|
@@ -7727,7 +7813,7 @@ export class biwriter {
|
|
|
7727
7813
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7728
7814
|
*
|
|
7729
7815
|
* @param {number} value - value as int
|
|
7730
|
-
* @param {string} endian - ``big`` or ``little
|
|
7816
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7731
7817
|
* @returns number
|
|
7732
7818
|
*/
|
|
7733
7819
|
ubit13(value, endian) {
|
|
@@ -7762,7 +7848,7 @@ export class biwriter {
|
|
|
7762
7848
|
*
|
|
7763
7849
|
* @param {number} value - value as int
|
|
7764
7850
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7765
|
-
* @param {string} endian - ``big`` or ``little
|
|
7851
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7766
7852
|
* @returns number
|
|
7767
7853
|
*/
|
|
7768
7854
|
bit14(value, unsigned, endian) {
|
|
@@ -7798,7 +7884,7 @@ export class biwriter {
|
|
|
7798
7884
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7799
7885
|
*
|
|
7800
7886
|
* @param {number} value - value as int
|
|
7801
|
-
* @param {string} endian - ``big`` or ``little
|
|
7887
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7802
7888
|
* @returns number
|
|
7803
7889
|
*/
|
|
7804
7890
|
ubit14(value, endian) {
|
|
@@ -7833,7 +7919,7 @@ export class biwriter {
|
|
|
7833
7919
|
*
|
|
7834
7920
|
* @param {number} value - value as int
|
|
7835
7921
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7836
|
-
* @param {string} endian - ``big`` or ``little
|
|
7922
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7837
7923
|
* @returns number
|
|
7838
7924
|
*/
|
|
7839
7925
|
bit15(value, unsigned, endian) {
|
|
@@ -7869,7 +7955,7 @@ export class biwriter {
|
|
|
7869
7955
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7870
7956
|
*
|
|
7871
7957
|
* @param {number} value - value as int
|
|
7872
|
-
* @param {string} endian - ``big`` or ``little
|
|
7958
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7873
7959
|
* @returns number
|
|
7874
7960
|
*/
|
|
7875
7961
|
ubit15(value, endian) {
|
|
@@ -7904,7 +7990,7 @@ export class biwriter {
|
|
|
7904
7990
|
*
|
|
7905
7991
|
* @param {number} value - value as int
|
|
7906
7992
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7907
|
-
* @param {string} endian - ``big`` or ``little
|
|
7993
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7908
7994
|
* @returns number
|
|
7909
7995
|
*/
|
|
7910
7996
|
bit16(value, unsigned, endian) {
|
|
@@ -7940,7 +8026,7 @@ export class biwriter {
|
|
|
7940
8026
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
7941
8027
|
*
|
|
7942
8028
|
* @param {number} value - value as int
|
|
7943
|
-
* @param {string} endian - ``big`` or ``little
|
|
8029
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7944
8030
|
* @returns number
|
|
7945
8031
|
*/
|
|
7946
8032
|
ubit16(value, endian) {
|
|
@@ -7975,7 +8061,7 @@ export class biwriter {
|
|
|
7975
8061
|
*
|
|
7976
8062
|
* @param {number} value - value as int
|
|
7977
8063
|
* @param {boolean} unsigned - if the value is unsigned
|
|
7978
|
-
* @param {string} endian - ``big`` or ``little
|
|
8064
|
+
* @param {string} endian - ``big`` or ``little``
|
|
7979
8065
|
* @returns number
|
|
7980
8066
|
*/
|
|
7981
8067
|
bit17(value, unsigned, endian) {
|
|
@@ -8011,7 +8097,7 @@ export class biwriter {
|
|
|
8011
8097
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8012
8098
|
*
|
|
8013
8099
|
* @param {number} value - value as int
|
|
8014
|
-
* @param {string} endian - ``big`` or ``little
|
|
8100
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8015
8101
|
* @returns number
|
|
8016
8102
|
*/
|
|
8017
8103
|
ubit17(value, endian) {
|
|
@@ -8046,7 +8132,7 @@ export class biwriter {
|
|
|
8046
8132
|
*
|
|
8047
8133
|
* @param {number} value - value as int
|
|
8048
8134
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8049
|
-
* @param {string} endian - ``big`` or ``little
|
|
8135
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8050
8136
|
* @returns number
|
|
8051
8137
|
*/
|
|
8052
8138
|
bit18(value, unsigned, endian) {
|
|
@@ -8082,7 +8168,7 @@ export class biwriter {
|
|
|
8082
8168
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8083
8169
|
*
|
|
8084
8170
|
* @param {number} value - value as int
|
|
8085
|
-
* @param {string} endian - ``big`` or ``little
|
|
8171
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8086
8172
|
* @returns number
|
|
8087
8173
|
*/
|
|
8088
8174
|
ubit18(value, endian) {
|
|
@@ -8117,7 +8203,7 @@ export class biwriter {
|
|
|
8117
8203
|
*
|
|
8118
8204
|
* @param {number} value - value as int
|
|
8119
8205
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8120
|
-
* @param {string} endian - ``big`` or ``little
|
|
8206
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8121
8207
|
* @returns number
|
|
8122
8208
|
*/
|
|
8123
8209
|
bit19(value, unsigned, endian) {
|
|
@@ -8153,7 +8239,7 @@ export class biwriter {
|
|
|
8153
8239
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8154
8240
|
*
|
|
8155
8241
|
* @param {number} value - value as int
|
|
8156
|
-
* @param {string} endian - ``big`` or ``little
|
|
8242
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8157
8243
|
* @returns number
|
|
8158
8244
|
*/
|
|
8159
8245
|
ubit19(value, endian) {
|
|
@@ -8188,7 +8274,7 @@ export class biwriter {
|
|
|
8188
8274
|
*
|
|
8189
8275
|
* @param {number} value - value as int
|
|
8190
8276
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8191
|
-
* @param {string} endian - ``big`` or ``little
|
|
8277
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8192
8278
|
* @returns number
|
|
8193
8279
|
*/
|
|
8194
8280
|
bit20(value, unsigned, endian) {
|
|
@@ -8224,7 +8310,7 @@ export class biwriter {
|
|
|
8224
8310
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8225
8311
|
*
|
|
8226
8312
|
* @param {number} value - value as int
|
|
8227
|
-
* @param {string} endian - ``big`` or ``little
|
|
8313
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8228
8314
|
* @returns number
|
|
8229
8315
|
*/
|
|
8230
8316
|
ubit20(value, endian) {
|
|
@@ -8259,7 +8345,7 @@ export class biwriter {
|
|
|
8259
8345
|
*
|
|
8260
8346
|
* @param {number} value - value as int
|
|
8261
8347
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8262
|
-
* @param {string} endian - ``big`` or ``little
|
|
8348
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8263
8349
|
* @returns number
|
|
8264
8350
|
*/
|
|
8265
8351
|
bit21(value, unsigned, endian) {
|
|
@@ -8295,7 +8381,7 @@ export class biwriter {
|
|
|
8295
8381
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8296
8382
|
*
|
|
8297
8383
|
* @param {number} value - value as int
|
|
8298
|
-
* @param {string} endian - ``big`` or ``little
|
|
8384
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8299
8385
|
* @returns number
|
|
8300
8386
|
*/
|
|
8301
8387
|
ubit21(value, endian) {
|
|
@@ -8330,7 +8416,7 @@ export class biwriter {
|
|
|
8330
8416
|
*
|
|
8331
8417
|
* @param {number} value - value as int
|
|
8332
8418
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8333
|
-
* @param {string} endian - ``big`` or ``little
|
|
8419
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8334
8420
|
* @returns number
|
|
8335
8421
|
*/
|
|
8336
8422
|
bit22(value, unsigned, endian) {
|
|
@@ -8366,7 +8452,7 @@ export class biwriter {
|
|
|
8366
8452
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8367
8453
|
*
|
|
8368
8454
|
* @param {number} value - value as int
|
|
8369
|
-
* @param {string} endian - ``big`` or ``little
|
|
8455
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8370
8456
|
* @returns number
|
|
8371
8457
|
*/
|
|
8372
8458
|
ubit22(value, endian) {
|
|
@@ -8401,7 +8487,7 @@ export class biwriter {
|
|
|
8401
8487
|
*
|
|
8402
8488
|
* @param {number} value - value as int
|
|
8403
8489
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8404
|
-
* @param {string} endian - ``big`` or ``little
|
|
8490
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8405
8491
|
* @returns number
|
|
8406
8492
|
*/
|
|
8407
8493
|
bit23(value, unsigned, endian) {
|
|
@@ -8437,7 +8523,7 @@ export class biwriter {
|
|
|
8437
8523
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8438
8524
|
*
|
|
8439
8525
|
* @param {number} value - value as int
|
|
8440
|
-
* @param {string} endian - ``big`` or ``little
|
|
8526
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8441
8527
|
* @returns number
|
|
8442
8528
|
*/
|
|
8443
8529
|
ubit23(value, endian) {
|
|
@@ -8472,7 +8558,7 @@ export class biwriter {
|
|
|
8472
8558
|
*
|
|
8473
8559
|
* @param {number} value - value as int
|
|
8474
8560
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8475
|
-
* @param {string} endian - ``big`` or ``little
|
|
8561
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8476
8562
|
* @returns number
|
|
8477
8563
|
*/
|
|
8478
8564
|
bit24(value, unsigned, endian) {
|
|
@@ -8508,7 +8594,7 @@ export class biwriter {
|
|
|
8508
8594
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8509
8595
|
*
|
|
8510
8596
|
* @param {number} value - value as int
|
|
8511
|
-
* @param {string} endian - ``big`` or ``little
|
|
8597
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8512
8598
|
* @returns number
|
|
8513
8599
|
*/
|
|
8514
8600
|
ubit24(value, endian) {
|
|
@@ -8543,7 +8629,7 @@ export class biwriter {
|
|
|
8543
8629
|
*
|
|
8544
8630
|
* @param {number} value - value as int
|
|
8545
8631
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8546
|
-
* @param {string} endian - ``big`` or ``little
|
|
8632
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8547
8633
|
* @returns number
|
|
8548
8634
|
*/
|
|
8549
8635
|
bit25(value, unsigned, endian) {
|
|
@@ -8579,7 +8665,7 @@ export class biwriter {
|
|
|
8579
8665
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8580
8666
|
*
|
|
8581
8667
|
* @param {number} value - value as int
|
|
8582
|
-
* @param {string} endian - ``big`` or ``little
|
|
8668
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8583
8669
|
* @returns number
|
|
8584
8670
|
*/
|
|
8585
8671
|
ubit25(value, endian) {
|
|
@@ -8614,7 +8700,7 @@ export class biwriter {
|
|
|
8614
8700
|
*
|
|
8615
8701
|
* @param {number} value - value as int
|
|
8616
8702
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8617
|
-
* @param {string} endian - ``big`` or ``little
|
|
8703
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8618
8704
|
* @returns number
|
|
8619
8705
|
*/
|
|
8620
8706
|
bit26(value, unsigned, endian) {
|
|
@@ -8650,7 +8736,7 @@ export class biwriter {
|
|
|
8650
8736
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8651
8737
|
*
|
|
8652
8738
|
* @param {number} value - value as int
|
|
8653
|
-
* @param {string} endian - ``big`` or ``little
|
|
8739
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8654
8740
|
* @returns number
|
|
8655
8741
|
*/
|
|
8656
8742
|
ubit26(value, endian) {
|
|
@@ -8685,7 +8771,7 @@ export class biwriter {
|
|
|
8685
8771
|
*
|
|
8686
8772
|
* @param {number} value - value as int
|
|
8687
8773
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8688
|
-
* @param {string} endian - ``big`` or ``little
|
|
8774
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8689
8775
|
* @returns number
|
|
8690
8776
|
*/
|
|
8691
8777
|
bit27(value, unsigned, endian) {
|
|
@@ -8721,7 +8807,7 @@ export class biwriter {
|
|
|
8721
8807
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8722
8808
|
*
|
|
8723
8809
|
* @param {number} value - value as int
|
|
8724
|
-
* @param {string} endian - ``big`` or ``little
|
|
8810
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8725
8811
|
* @returns number
|
|
8726
8812
|
*/
|
|
8727
8813
|
ubit27(value, endian) {
|
|
@@ -8756,7 +8842,7 @@ export class biwriter {
|
|
|
8756
8842
|
*
|
|
8757
8843
|
* @param {number} value - value as int
|
|
8758
8844
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8759
|
-
* @param {string} endian - ``big`` or ``little
|
|
8845
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8760
8846
|
* @returns number
|
|
8761
8847
|
*/
|
|
8762
8848
|
bit28(value, unsigned, endian) {
|
|
@@ -8792,7 +8878,7 @@ export class biwriter {
|
|
|
8792
8878
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8793
8879
|
*
|
|
8794
8880
|
* @param {number} value - value as int
|
|
8795
|
-
* @param {string} endian - ``big`` or ``little
|
|
8881
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8796
8882
|
* @returns number
|
|
8797
8883
|
*/
|
|
8798
8884
|
ubit28(value, endian) {
|
|
@@ -8827,7 +8913,7 @@ export class biwriter {
|
|
|
8827
8913
|
*
|
|
8828
8914
|
* @param {number} value - value as int
|
|
8829
8915
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8830
|
-
* @param {string} endian - ``big`` or ``little
|
|
8916
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8831
8917
|
* @returns number
|
|
8832
8918
|
*/
|
|
8833
8919
|
bit29(value, unsigned, endian) {
|
|
@@ -8863,7 +8949,7 @@ export class biwriter {
|
|
|
8863
8949
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8864
8950
|
*
|
|
8865
8951
|
* @param {number} value - value as int
|
|
8866
|
-
* @param {string} endian - ``big`` or ``little
|
|
8952
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8867
8953
|
* @returns number
|
|
8868
8954
|
*/
|
|
8869
8955
|
ubit29(value, endian) {
|
|
@@ -8898,7 +8984,7 @@ export class biwriter {
|
|
|
8898
8984
|
*
|
|
8899
8985
|
* @param {number} value - value as int
|
|
8900
8986
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8901
|
-
* @param {string} endian - ``big`` or ``little
|
|
8987
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8902
8988
|
* @returns number
|
|
8903
8989
|
*/
|
|
8904
8990
|
bit30(value, unsigned, endian) {
|
|
@@ -8934,7 +9020,7 @@ export class biwriter {
|
|
|
8934
9020
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
8935
9021
|
*
|
|
8936
9022
|
* @param {number} value - value as int
|
|
8937
|
-
* @param {string} endian - ``big`` or ``little
|
|
9023
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8938
9024
|
* @returns number
|
|
8939
9025
|
*/
|
|
8940
9026
|
ubit30(value, endian) {
|
|
@@ -8969,7 +9055,7 @@ export class biwriter {
|
|
|
8969
9055
|
*
|
|
8970
9056
|
* @param {number} value - value as int
|
|
8971
9057
|
* @param {boolean} unsigned - if the value is unsigned
|
|
8972
|
-
* @param {string} endian - ``big`` or ``little
|
|
9058
|
+
* @param {string} endian - ``big`` or ``little``
|
|
8973
9059
|
* @returns number
|
|
8974
9060
|
*/
|
|
8975
9061
|
bit31(value, unsigned, endian) {
|
|
@@ -9005,7 +9091,7 @@ export class biwriter {
|
|
|
9005
9091
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
9006
9092
|
*
|
|
9007
9093
|
* @param {number} value - value as int
|
|
9008
|
-
* @param {string} endian - ``big`` or ``little
|
|
9094
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9009
9095
|
* @returns number
|
|
9010
9096
|
*/
|
|
9011
9097
|
ubit31(value, endian) {
|
|
@@ -9040,7 +9126,7 @@ export class biwriter {
|
|
|
9040
9126
|
*
|
|
9041
9127
|
* @param {number} value - value as int
|
|
9042
9128
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9043
|
-
* @param {string} endian - ``big`` or ``little
|
|
9129
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9044
9130
|
* @returns number
|
|
9045
9131
|
*/
|
|
9046
9132
|
bit32(value, unsigned, endian) {
|
|
@@ -9076,7 +9162,7 @@ export class biwriter {
|
|
|
9076
9162
|
* Note: When returning to a byte write, remaining bits are dropped
|
|
9077
9163
|
*
|
|
9078
9164
|
* @param {number} value - value as int
|
|
9079
|
-
* @param {string} endian - ``big`` or ``little
|
|
9165
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9080
9166
|
* @returns number
|
|
9081
9167
|
*/
|
|
9082
9168
|
ubit32(value, endian) {
|
|
@@ -9126,6 +9212,14 @@ export class biwriter {
|
|
|
9126
9212
|
return rbyte(this, unsigned);
|
|
9127
9213
|
}
|
|
9128
9214
|
/**
|
|
9215
|
+
* Read unsigned byte
|
|
9216
|
+
*
|
|
9217
|
+
* @returns number
|
|
9218
|
+
*/
|
|
9219
|
+
readUByte() {
|
|
9220
|
+
return rbyte(this, true);
|
|
9221
|
+
}
|
|
9222
|
+
/**
|
|
9129
9223
|
* Write byte
|
|
9130
9224
|
*
|
|
9131
9225
|
* @param {number} value - value as int
|
|
@@ -9175,7 +9269,7 @@ export class biwriter {
|
|
|
9175
9269
|
*
|
|
9176
9270
|
* @param {number} value - value as int
|
|
9177
9271
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9178
|
-
* @param {string} endian - ``big`` or ``little
|
|
9272
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9179
9273
|
*/
|
|
9180
9274
|
writeInt16(value, unsigned, endian) {
|
|
9181
9275
|
return wint16(this, value, unsigned, endian);
|
|
@@ -9184,7 +9278,7 @@ export class biwriter {
|
|
|
9184
9278
|
* Read short
|
|
9185
9279
|
*
|
|
9186
9280
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
9187
|
-
* @param {string} endian -
|
|
9281
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9188
9282
|
* @returns number
|
|
9189
9283
|
*/
|
|
9190
9284
|
readInt16(unsigned, endian) {
|
|
@@ -9195,7 +9289,7 @@ export class biwriter {
|
|
|
9195
9289
|
*
|
|
9196
9290
|
* @param {number} value - value as int
|
|
9197
9291
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9198
|
-
* @param {string} endian - ``big`` or ``little
|
|
9292
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9199
9293
|
*/
|
|
9200
9294
|
int16(value, unsigned, endian) {
|
|
9201
9295
|
return this.writeInt16(value, unsigned, endian);
|
|
@@ -9205,7 +9299,7 @@ export class biwriter {
|
|
|
9205
9299
|
*
|
|
9206
9300
|
* @param {number} value - value as int
|
|
9207
9301
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9208
|
-
* @param {string} endian - ``big`` or ``little
|
|
9302
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9209
9303
|
*/
|
|
9210
9304
|
short(value, unsigned, endian) {
|
|
9211
9305
|
return this.writeInt16(value, unsigned, endian);
|
|
@@ -9215,7 +9309,7 @@ export class biwriter {
|
|
|
9215
9309
|
*
|
|
9216
9310
|
* @param {number} value - value as int
|
|
9217
9311
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9218
|
-
* @param {string} endian - ``big`` or ``little
|
|
9312
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9219
9313
|
*/
|
|
9220
9314
|
word(value, unsigned, endian) {
|
|
9221
9315
|
return this.writeInt16(value, unsigned, endian);
|
|
@@ -9224,7 +9318,7 @@ export class biwriter {
|
|
|
9224
9318
|
* Write unsigned int16
|
|
9225
9319
|
*
|
|
9226
9320
|
* @param {number} value - value as int
|
|
9227
|
-
* @param {string} endian - ``big`` or ``little
|
|
9321
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9228
9322
|
*/
|
|
9229
9323
|
writeUInt16(value, endian) {
|
|
9230
9324
|
return this.writeInt16(value, true, endian);
|
|
@@ -9233,7 +9327,7 @@ export class biwriter {
|
|
|
9233
9327
|
* Write unsigned int16
|
|
9234
9328
|
*
|
|
9235
9329
|
* @param {number} value - value as int
|
|
9236
|
-
* @param {string} endian - ``big`` or ``little
|
|
9330
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9237
9331
|
*/
|
|
9238
9332
|
uint16(value, endian) {
|
|
9239
9333
|
return this.writeInt16(value, true, endian);
|
|
@@ -9242,7 +9336,7 @@ export class biwriter {
|
|
|
9242
9336
|
* Write unsigned int16
|
|
9243
9337
|
*
|
|
9244
9338
|
* @param {number} value - value as int
|
|
9245
|
-
* @param {string} endian - ``big`` or ``little
|
|
9339
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9246
9340
|
*/
|
|
9247
9341
|
ushort(value, endian) {
|
|
9248
9342
|
return this.writeInt16(value, true, endian);
|
|
@@ -9251,7 +9345,7 @@ export class biwriter {
|
|
|
9251
9345
|
* Write unsigned int16
|
|
9252
9346
|
*
|
|
9253
9347
|
* @param {number} value - value as int
|
|
9254
|
-
* @param {string} endian - ``big`` or ``little
|
|
9348
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9255
9349
|
*/
|
|
9256
9350
|
uword(value, endian) {
|
|
9257
9351
|
return this.writeInt16(value, true, endian);
|
|
@@ -9391,7 +9485,7 @@ export class biwriter {
|
|
|
9391
9485
|
* Writes half float
|
|
9392
9486
|
*
|
|
9393
9487
|
* @param {number} value - value as int
|
|
9394
|
-
* @param {string} endian - ``big`` or ``little
|
|
9488
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9395
9489
|
*/
|
|
9396
9490
|
writeHalfFloat(value, endian) {
|
|
9397
9491
|
return whalffloat(this, value, endian);
|
|
@@ -9399,7 +9493,7 @@ export class biwriter {
|
|
|
9399
9493
|
/**
|
|
9400
9494
|
* Read half float
|
|
9401
9495
|
*
|
|
9402
|
-
* @param {string} endian -
|
|
9496
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9403
9497
|
* @returns number
|
|
9404
9498
|
*/
|
|
9405
9499
|
readHalfFloat(endian) {
|
|
@@ -9409,7 +9503,7 @@ export class biwriter {
|
|
|
9409
9503
|
* Writes half float
|
|
9410
9504
|
*
|
|
9411
9505
|
* @param {number} value - value as int
|
|
9412
|
-
* @param {string} endian - ``big`` or ``little
|
|
9506
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9413
9507
|
*/
|
|
9414
9508
|
half(value, endian) {
|
|
9415
9509
|
return this.writeHalfFloat(value, endian);
|
|
@@ -9418,7 +9512,7 @@ export class biwriter {
|
|
|
9418
9512
|
* Writes half float
|
|
9419
9513
|
*
|
|
9420
9514
|
* @param {number} value - value as int
|
|
9421
|
-
* @param {string} endian - ``big`` or ``little
|
|
9515
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9422
9516
|
*/
|
|
9423
9517
|
halffloat(value, endian) {
|
|
9424
9518
|
return this.writeHalfFloat(value, endian);
|
|
@@ -9479,7 +9573,7 @@ export class biwriter {
|
|
|
9479
9573
|
*
|
|
9480
9574
|
* @param {number} value - value as int
|
|
9481
9575
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9482
|
-
* @param {string} endian - ``big`` or ``little
|
|
9576
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9483
9577
|
*/
|
|
9484
9578
|
writeInt32(value, unsigned, endian) {
|
|
9485
9579
|
return wint32(this, value, unsigned, endian);
|
|
@@ -9488,7 +9582,7 @@ export class biwriter {
|
|
|
9488
9582
|
* Read 32 bit integer
|
|
9489
9583
|
*
|
|
9490
9584
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
9491
|
-
* @param {string} endian -
|
|
9585
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9492
9586
|
* @returns number
|
|
9493
9587
|
*/
|
|
9494
9588
|
readInt32(unsigned, endian) {
|
|
@@ -9499,7 +9593,7 @@ export class biwriter {
|
|
|
9499
9593
|
*
|
|
9500
9594
|
* @param {number} value - value as int
|
|
9501
9595
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9502
|
-
* @param {string} endian - ``big`` or ``little
|
|
9596
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9503
9597
|
*/
|
|
9504
9598
|
int(value, unsigned, endian) {
|
|
9505
9599
|
return this.writeInt32(value, unsigned, endian);
|
|
@@ -9509,7 +9603,7 @@ export class biwriter {
|
|
|
9509
9603
|
*
|
|
9510
9604
|
* @param {number} value - value as int
|
|
9511
9605
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9512
|
-
* @param {string} endian - ``big`` or ``little
|
|
9606
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9513
9607
|
*/
|
|
9514
9608
|
int32(value, unsigned, endian) {
|
|
9515
9609
|
return this.writeInt32(value, unsigned, endian);
|
|
@@ -9519,7 +9613,7 @@ export class biwriter {
|
|
|
9519
9613
|
*
|
|
9520
9614
|
* @param {number} value - value as int
|
|
9521
9615
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9522
|
-
* @param {string} endian - ``big`` or ``little
|
|
9616
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9523
9617
|
*/
|
|
9524
9618
|
double(value, unsigned, endian) {
|
|
9525
9619
|
return this.writeInt32(value, unsigned, endian);
|
|
@@ -9529,7 +9623,7 @@ export class biwriter {
|
|
|
9529
9623
|
*
|
|
9530
9624
|
* @param {number} value - value as int
|
|
9531
9625
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9532
|
-
* @param {string} endian - ``big`` or ``little
|
|
9626
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9533
9627
|
*/
|
|
9534
9628
|
long(value, unsigned, endian) {
|
|
9535
9629
|
return this.writeInt32(value, unsigned, endian);
|
|
@@ -9746,7 +9840,7 @@ export class biwriter {
|
|
|
9746
9840
|
* Write float
|
|
9747
9841
|
*
|
|
9748
9842
|
* @param {number} value - value as int
|
|
9749
|
-
* @param {string} endian - ``big`` or ``little
|
|
9843
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9750
9844
|
*/
|
|
9751
9845
|
writeFloat(value, endian) {
|
|
9752
9846
|
return wfloat(this, value, endian);
|
|
@@ -9754,7 +9848,7 @@ export class biwriter {
|
|
|
9754
9848
|
/**
|
|
9755
9849
|
* Read float
|
|
9756
9850
|
*
|
|
9757
|
-
* @param {string} endian -
|
|
9851
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9758
9852
|
* @returns number
|
|
9759
9853
|
*/
|
|
9760
9854
|
readFloat(endian) {
|
|
@@ -9764,7 +9858,7 @@ export class biwriter {
|
|
|
9764
9858
|
* Write float
|
|
9765
9859
|
*
|
|
9766
9860
|
* @param {number} value - value as int
|
|
9767
|
-
* @param {string} endian - ``big`` or ``little
|
|
9861
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9768
9862
|
*/
|
|
9769
9863
|
float(value, endian) {
|
|
9770
9864
|
return this.writeFloat(value, endian);
|
|
@@ -9809,7 +9903,7 @@ export class biwriter {
|
|
|
9809
9903
|
*
|
|
9810
9904
|
* @param {number} value - value as int
|
|
9811
9905
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9812
|
-
* @param {string} endian - ``big`` or ``little
|
|
9906
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9813
9907
|
*/
|
|
9814
9908
|
writeInt64(value, unsigned, endian) {
|
|
9815
9909
|
return wint64(this, value, unsigned, endian);
|
|
@@ -9817,7 +9911,7 @@ export class biwriter {
|
|
|
9817
9911
|
/**
|
|
9818
9912
|
* Read signed 64 bit integer
|
|
9819
9913
|
* @param {boolean} unsigned - if value is unsigned or not
|
|
9820
|
-
* @param {string} endian -
|
|
9914
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9821
9915
|
* @returns number
|
|
9822
9916
|
*/
|
|
9823
9917
|
readInt64(unsigned, endian) {
|
|
@@ -9828,7 +9922,7 @@ export class biwriter {
|
|
|
9828
9922
|
*
|
|
9829
9923
|
* @param {number} value - value as int
|
|
9830
9924
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9831
|
-
* @param {string} endian - ``big`` or ``little
|
|
9925
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9832
9926
|
*/
|
|
9833
9927
|
int64(value, unsigned, endian) {
|
|
9834
9928
|
return this.writeInt64(value, unsigned, endian);
|
|
@@ -9838,7 +9932,7 @@ export class biwriter {
|
|
|
9838
9932
|
*
|
|
9839
9933
|
* @param {number} value - value as int
|
|
9840
9934
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9841
|
-
* @param {string} endian - ``big`` or ``little
|
|
9935
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9842
9936
|
*/
|
|
9843
9937
|
quad(value, unsigned, endian) {
|
|
9844
9938
|
return this.writeInt64(value, unsigned, endian);
|
|
@@ -9848,7 +9942,7 @@ export class biwriter {
|
|
|
9848
9942
|
*
|
|
9849
9943
|
* @param {number} value - value as int
|
|
9850
9944
|
* @param {boolean} unsigned - if the value is unsigned
|
|
9851
|
-
* @param {string} endian - ``big`` or ``little
|
|
9945
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9852
9946
|
*/
|
|
9853
9947
|
bigint(value, unsigned, endian) {
|
|
9854
9948
|
return this.writeInt64(value, unsigned, endian);
|
|
@@ -9857,7 +9951,7 @@ export class biwriter {
|
|
|
9857
9951
|
* Write unsigned 64 bit integer
|
|
9858
9952
|
*
|
|
9859
9953
|
* @param {number} value - value as int
|
|
9860
|
-
* @param {string} endian - ``big`` or ``little
|
|
9954
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9861
9955
|
*/
|
|
9862
9956
|
writeUInt64(value, endian) {
|
|
9863
9957
|
return this.writeInt64(value, true, endian);
|
|
@@ -9866,7 +9960,7 @@ export class biwriter {
|
|
|
9866
9960
|
* Write unsigned 64 bit integer
|
|
9867
9961
|
*
|
|
9868
9962
|
* @param {number} value - value as int
|
|
9869
|
-
* @param {string} endian - ``big`` or ``little
|
|
9963
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9870
9964
|
*/
|
|
9871
9965
|
uint64(value, endian) {
|
|
9872
9966
|
return this.writeInt64(value, true, endian);
|
|
@@ -9875,7 +9969,7 @@ export class biwriter {
|
|
|
9875
9969
|
* Write unsigned 64 bit integer
|
|
9876
9970
|
*
|
|
9877
9971
|
* @param {number} value - value as int
|
|
9878
|
-
* @param {string} endian - ``big`` or ``little
|
|
9972
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9879
9973
|
*/
|
|
9880
9974
|
ubigint(value, endian) {
|
|
9881
9975
|
return this.writeInt64(value, true, endian);
|
|
@@ -9884,7 +9978,7 @@ export class biwriter {
|
|
|
9884
9978
|
* Write unsigned 64 bit integer
|
|
9885
9979
|
*
|
|
9886
9980
|
* @param {number} value - value as int
|
|
9887
|
-
* @param {string} endian - ``big`` or ``little
|
|
9981
|
+
* @param {string} endian - ``big`` or ``little``
|
|
9888
9982
|
*/
|
|
9889
9983
|
uquad(value, endian) {
|
|
9890
9984
|
return this.writeInt64(value, true, endian);
|
|
@@ -10024,8 +10118,7 @@ export class biwriter {
|
|
|
10024
10118
|
* Writes double float
|
|
10025
10119
|
*
|
|
10026
10120
|
* @param {number} value - value as int
|
|
10027
|
-
* @param {
|
|
10028
|
-
* @param {string} endian - ``big`` or ``little`
|
|
10121
|
+
* @param {string} endian - ``big`` or ``little``
|
|
10029
10122
|
*/
|
|
10030
10123
|
writeDoubleFloat(value, endian) {
|
|
10031
10124
|
return wdfloat(this, value, endian);
|
|
@@ -10033,7 +10126,7 @@ export class biwriter {
|
|
|
10033
10126
|
/**
|
|
10034
10127
|
* Read double float
|
|
10035
10128
|
*
|
|
10036
|
-
* @param {string} endian -
|
|
10129
|
+
* @param {string} endian - ``big`` or ``little``
|
|
10037
10130
|
* @returns number
|
|
10038
10131
|
*/
|
|
10039
10132
|
readDoubleFloat(endian) {
|
|
@@ -10043,7 +10136,7 @@ export class biwriter {
|
|
|
10043
10136
|
* Writes double float
|
|
10044
10137
|
*
|
|
10045
10138
|
* @param {number} value - value as int
|
|
10046
|
-
* @param {string} endian - ``big`` or ``little
|
|
10139
|
+
* @param {string} endian - ``big`` or ``little``
|
|
10047
10140
|
*/
|
|
10048
10141
|
doublefloat(value, endian) {
|
|
10049
10142
|
return this.writeDoubleFloat(value, endian);
|
|
@@ -10052,7 +10145,7 @@ export class biwriter {
|
|
|
10052
10145
|
* Writes double float
|
|
10053
10146
|
*
|
|
10054
10147
|
* @param {number} value - value as int
|
|
10055
|
-
* @param {string} endian - ``big`` or ``little
|
|
10148
|
+
* @param {string} endian - ``big`` or ``little``
|
|
10056
10149
|
*/
|
|
10057
10150
|
dfloat(value, endian) {
|
|
10058
10151
|
return this.writeDoubleFloat(value, endian);
|