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