bireader 1.0.25 → 1.0.27

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