bireader 1.0.59 → 2.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/README.md +215 -211
  2. package/build/cjs/bireader.d.ts +2368 -0
  3. package/build/cjs/bireader.d.ts.map +1 -0
  4. package/build/cjs/bireader.js +3048 -0
  5. package/build/cjs/bireader.js.map +1 -0
  6. package/build/cjs/biwriter.d.ts +2355 -0
  7. package/build/cjs/biwriter.d.ts.map +1 -0
  8. package/build/cjs/biwriter.js +3082 -0
  9. package/build/cjs/biwriter.js.map +1 -0
  10. package/build/cjs/common.d.ts +1386 -0
  11. package/build/cjs/common.d.ts.map +1 -0
  12. package/build/cjs/common.js +3531 -0
  13. package/build/cjs/common.js.map +1 -0
  14. package/{lib/cjs/index.d.cts → build/cjs/index.d.ts} +36 -0
  15. package/build/cjs/index.d.ts.map +1 -0
  16. package/{lib/cjs/index.cjs → build/cjs/index.js} +56 -6
  17. package/{lib/cjs/index.cjs.map → build/cjs/index.js.map} +1 -1
  18. package/build/esm/bireader.d.ts +2368 -0
  19. package/build/esm/bireader.d.ts.map +1 -0
  20. package/build/esm/bireader.js +3048 -0
  21. package/build/esm/bireader.js.map +1 -0
  22. package/build/esm/biwriter.d.ts +2355 -0
  23. package/build/esm/biwriter.d.ts.map +1 -0
  24. package/build/esm/biwriter.js +3082 -0
  25. package/build/esm/biwriter.js.map +1 -0
  26. package/build/esm/common.d.ts +1386 -0
  27. package/build/esm/common.d.ts.map +1 -0
  28. package/build/esm/common.js +3531 -0
  29. package/build/esm/common.js.map +1 -0
  30. package/{lib/esm/index.d.mts → build/esm/index.d.ts} +36 -0
  31. package/build/esm/index.d.ts.map +1 -0
  32. package/{lib/esm/index.mjs → build/esm/index.js} +64 -8
  33. package/build/esm/index.js.map +1 -0
  34. package/package.json +10 -14
  35. package/lib/cjs/index.d.cts.map +0 -1
  36. package/lib/esm/index.d.mts.map +0 -1
  37. package/lib/esm/index.mjs.map +0 -1
@@ -0,0 +1,3082 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BiWriter = void 0;
4
+ const common_1 = require("./common");
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 0-7 to start writer (default 0)
11
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
12
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
13
+ *
14
+ * @since 2.0
15
+ */
16
+ class BiWriter extends common_1.ReaderBase {
17
+ /**
18
+ * Binary writer, includes bitfields and strings.
19
+ *
20
+ * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
21
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
22
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
23
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
24
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
25
+ */
26
+ constructor(data, byteOffset, bitOffset, endianness, strict) {
27
+ super();
28
+ this.strict = false;
29
+ if (data == undefined) {
30
+ if (typeof Buffer !== 'undefined') {
31
+ this.data = Buffer.alloc(this.offset || 1 + (this.bitoffset != 0 ? 1 : 0));
32
+ }
33
+ else {
34
+ this.data = new Uint8Array(this.offset || 1 + (this.bitoffset != 0 ? 1 : 0));
35
+ }
36
+ }
37
+ else {
38
+ if (!this.isBufferOrUint8Array(data)) {
39
+ throw new Error("Write data must be Uint8Array or Buffer.");
40
+ }
41
+ this.data = data;
42
+ }
43
+ this.size = this.data.length;
44
+ this.sizeB = this.data.length * 8;
45
+ if (typeof strict == "boolean") {
46
+ this.strict = strict;
47
+ }
48
+ else {
49
+ if (strict != undefined) {
50
+ throw new Error("Strict mode must be true of false.");
51
+ }
52
+ }
53
+ if (endianness != undefined && typeof endianness != "string") {
54
+ throw new Error("endianness must be big or little.");
55
+ }
56
+ if (endianness != undefined && !(endianness == "big" || endianness == "little")) {
57
+ throw new Error("Endianness must be big or little.");
58
+ }
59
+ this.endian = endianness || "little";
60
+ if (byteOffset != undefined || bitOffset != undefined) {
61
+ this.offset = ((Math.abs(byteOffset || 0)) + Math.ceil((Math.abs(bitOffset || 0)) / 8));
62
+ // Adjust byte offset based on bit overflow
63
+ this.offset += Math.floor((Math.abs(bitOffset || 0)) / 8);
64
+ // Adjust bit offset
65
+ this.bitoffset = (Math.abs(bitOffset || 0) + 64) % 8;
66
+ // Ensure bit offset stays between 0-7
67
+ this.bitoffset = Math.min(Math.max(this.bitoffset, 0), 7);
68
+ // Ensure offset doesn't go negative
69
+ this.offset = Math.max(this.offset, 0);
70
+ if (this.offset > this.size) {
71
+ if (this.strict == false) {
72
+ this.extendArray(this.offset - this.size);
73
+ }
74
+ else {
75
+ throw new Error(`Starting offset outside of size: ${this.offset} of ${this.size}`);
76
+ }
77
+ }
78
+ }
79
+ }
80
+ //
81
+ //bit writer
82
+ //
83
+ /**
84
+ * Bit field writer.
85
+ *
86
+ * Note: When returning to a byte write, remaining bits are dropped.
87
+ *
88
+ * @param {number} value - value as int
89
+ * @param {number} bits - bits to write
90
+ * @param {boolean} unsigned - if the value is unsigned
91
+ * @param {string} endian - ``big`` or ``little``
92
+ * @returns {number}
93
+ */
94
+ bit(value, bits, unsigned, endian) {
95
+ return this.writeBit(value, bits, unsigned, endian);
96
+ }
97
+ /**
98
+ * Bit field writer.
99
+ *
100
+ * Note: When returning to a byte write, remaining bits are dropped.
101
+ *
102
+ * @param {number} value - value as int
103
+ * @param {number} bits - bits to write
104
+ * @param {string} endian - ``big`` or ``little``
105
+ * @returns {number}
106
+ */
107
+ ubit(value, bits, endian) {
108
+ return this.writeBit(value, bits, true, endian);
109
+ }
110
+ /**
111
+ * Bit field writer.
112
+ *
113
+ * Note: When returning to a byte write, remaining bits are dropped.
114
+ *
115
+ * @param {number} value - value as int
116
+ * @param {number} bits - bits to write
117
+ * @param {boolean} unsigned - if the value is unsigned
118
+ * @returns {number}
119
+ */
120
+ bitbe(value, bits, unsigned) {
121
+ return this.bit(value, bits, unsigned, "big");
122
+ }
123
+ /**
124
+ * Bit field writer.
125
+ *
126
+ * Note: When returning to a byte write, remaining bits are dropped.
127
+ *
128
+ * @param {number} value - value as int
129
+ * @param {number} bits - bits to write
130
+ * @returns {number}
131
+ */
132
+ ubitbe(value, bits) {
133
+ return this.bit(value, bits, true, "big");
134
+ }
135
+ /**
136
+ * Bit field writer.
137
+ *
138
+ * Note: When returning to a byte write, remaining bits are dropped.
139
+ *
140
+ * @param {number} value - value as int
141
+ * @param {number} bits - bits to write
142
+ * @returns {number}
143
+ */
144
+ ubitle(value, bits) {
145
+ return this.bit(value, bits, true, "little");
146
+ }
147
+ /**
148
+ * Bit field writer.
149
+ *
150
+ * Note: When returning to a byte write, remaining bits are dropped.
151
+ *
152
+ * @param {number} value - value as int
153
+ * @param {number} bits - bits to write
154
+ * @param {boolean} unsigned - if the value is unsigned
155
+ * @returns {number}
156
+ */
157
+ bitle(value, bits, unsigned) {
158
+ return this.bit(value, bits, unsigned, "little");
159
+ }
160
+ /**
161
+ * Bit field writer. Writes 1 bit.
162
+ *
163
+ * Note: When returning to a byte write, remaining bits are dropped.
164
+ *
165
+ * @param {number} value - value as int
166
+ */
167
+ set bit1(value) {
168
+ this.bit(value, 1);
169
+ }
170
+ /**
171
+ * Bit field writer. Writes 1 bit.
172
+ *
173
+ * Note: When returning to a byte write, remaining bits are dropped.
174
+ *
175
+ * @param {number} value - value as int
176
+ */
177
+ set bit1le(value) {
178
+ this.bit(value, 1, undefined, "little");
179
+ }
180
+ /**
181
+ * Bit field writer. Writes 1 bit.
182
+ *
183
+ * Note: When returning to a byte write, remaining bits are dropped.
184
+ *
185
+ * @param {number} value - value as int
186
+ */
187
+ set bit1be(value) {
188
+ this.bit(value, 1, undefined, "big");
189
+ }
190
+ /**
191
+ * Bit field writer. Writes 1 bit.
192
+ *
193
+ * Note: When returning to a byte write, remaining bits are dropped.
194
+ *
195
+ * @param {number} value - value as int
196
+ */
197
+ set ubit1(value) {
198
+ this.bit(value, 1, true);
199
+ }
200
+ /**
201
+ * Bit field writer. Writes 1 bit.
202
+ *
203
+ * Note: When returning to a byte write, remaining bits are dropped.
204
+ *
205
+ * @param {number} value - value as int
206
+ */
207
+ set ubit1le(value) {
208
+ this.bit(value, 1, true, "little");
209
+ ;
210
+ }
211
+ /**
212
+ * Bit field writer. Writes 1 bit.
213
+ *
214
+ * Note: When returning to a byte write, remaining bits are dropped.
215
+ *
216
+ * @param {number} value - value as int
217
+ */
218
+ set ubit1be(value) {
219
+ this.bit(value, 1, true, "big");
220
+ }
221
+ /**
222
+ * Bit field writer. Writes 2 bits.
223
+ *
224
+ * Note: When returning to a byte write, remaining bits are dropped.
225
+ *
226
+ * @param {number} value - value as int
227
+ */
228
+ set bit2(value) {
229
+ this.bit(value, 2);
230
+ }
231
+ /**
232
+ * Bit field writer. Writes 2 bits.
233
+ *
234
+ * Note: When returning to a byte write, remaining bits are dropped.
235
+ *
236
+ * @param {number} value - value as int
237
+ */
238
+ set bit2le(value) {
239
+ this.bit(value, 2, undefined, "little");
240
+ }
241
+ /**
242
+ * Bit field writer. Writes 2 bits.
243
+ *
244
+ * Note: When returning to a byte write, remaining bits are dropped.
245
+ *
246
+ * @param {number} value - value as int
247
+ */
248
+ set bit2be(value) {
249
+ this.bit(value, 2, undefined, "big");
250
+ }
251
+ /**
252
+ * Bit field writer. Writes 2 bits.
253
+ *
254
+ * Note: When returning to a byte write, remaining bits are dropped.
255
+ *
256
+ * @param {number} value - value as int
257
+ */
258
+ set ubit2(value) {
259
+ this.bit(value, 2, true);
260
+ }
261
+ /**
262
+ * Bit field writer. Writes 2 bits.
263
+ *
264
+ * Note: When returning to a byte write, remaining bits are dropped.
265
+ *
266
+ * @param {number} value - value as int
267
+ */
268
+ set ubit2le(value) {
269
+ this.bit(value, 2, true, "little");
270
+ ;
271
+ }
272
+ /**
273
+ * Bit field writer. Writes 2 bits.
274
+ *
275
+ * Note: When returning to a byte write, remaining bits are dropped.
276
+ *
277
+ * @param {number} value - value as int
278
+ */
279
+ set ubit2be(value) {
280
+ this.bit(value, 2, true, "big");
281
+ }
282
+ /**
283
+ * Bit field writer. Writes 3 bits.
284
+ *
285
+ * Note: When returning to a byte write, remaining bits are dropped.
286
+ *
287
+ * @param {number} value - value as int
288
+ */
289
+ set bit3(value) {
290
+ this.bit(value, 3);
291
+ }
292
+ /**
293
+ * Bit field writer. Writes 3 bits.
294
+ *
295
+ * Note: When returning to a byte write, remaining bits are dropped.
296
+ *
297
+ * @param {number} value - value as int
298
+ */
299
+ set bit3le(value) {
300
+ this.bit(value, 3, undefined, "little");
301
+ }
302
+ /**
303
+ * Bit field writer. Writes 3 bits.
304
+ *
305
+ * Note: When returning to a byte write, remaining bits are dropped.
306
+ *
307
+ * @param {number} value - value as int
308
+ */
309
+ set bit3be(value) {
310
+ this.bit(value, 3, undefined, "big");
311
+ }
312
+ /**
313
+ * Bit field writer. Writes 3 bits.
314
+ *
315
+ * Note: When returning to a byte write, remaining bits are dropped.
316
+ *
317
+ * @param {number} value - value as int
318
+ */
319
+ set ubit3(value) {
320
+ this.bit(value, 3, true);
321
+ }
322
+ /**
323
+ * Bit field writer. Writes 3 bits.
324
+ *
325
+ * Note: When returning to a byte write, remaining bits are dropped.
326
+ *
327
+ * @param {number} value - value as int
328
+ */
329
+ set ubit3le(value) {
330
+ this.bit(value, 3, true, "little");
331
+ ;
332
+ }
333
+ /**
334
+ * Bit field writer. Writes 3 bits.
335
+ *
336
+ * Note: When returning to a byte write, remaining bits are dropped.
337
+ *
338
+ * @param {number} value - value as int
339
+ */
340
+ set ubit3be(value) {
341
+ this.bit(value, 3, true, "big");
342
+ }
343
+ /**
344
+ * Bit field writer. Writes 4 bits.
345
+ *
346
+ * Note: When returning to a byte write, remaining bits are dropped.
347
+ *
348
+ * @param {number} value - value as int
349
+ */
350
+ set bit4(value) {
351
+ this.bit(value, 4);
352
+ }
353
+ /**
354
+ * Bit field writer. Writes 4 bits.
355
+ *
356
+ * Note: When returning to a byte write, remaining bits are dropped.
357
+ *
358
+ * @param {number} value - value as int
359
+ */
360
+ set bit4le(value) {
361
+ this.bit(value, 4, undefined, "little");
362
+ }
363
+ /**
364
+ * Bit field writer. Writes 4 bits.
365
+ *
366
+ * Note: When returning to a byte write, remaining bits are dropped.
367
+ *
368
+ * @param {number} value - value as int
369
+ */
370
+ set bit4be(value) {
371
+ this.bit(value, 4, undefined, "big");
372
+ }
373
+ /**
374
+ * Bit field writer. Writes 4 bits.
375
+ *
376
+ * Note: When returning to a byte write, remaining bits are dropped.
377
+ *
378
+ * @param {number} value - value as int
379
+ */
380
+ set ubit4(value) {
381
+ this.bit(value, 4, true);
382
+ }
383
+ /**
384
+ * Bit field writer. Writes 4 bits.
385
+ *
386
+ * Note: When returning to a byte write, remaining bits are dropped.
387
+ *
388
+ * @param {number} value - value as int
389
+ */
390
+ set ubit4le(value) {
391
+ this.bit(value, 4, true, "little");
392
+ ;
393
+ }
394
+ /**
395
+ * Bit field writer. Writes 4 bits.
396
+ *
397
+ * Note: When returning to a byte write, remaining bits are dropped.
398
+ *
399
+ * @param {number} value - value as int
400
+ */
401
+ set ubit4be(value) {
402
+ this.bit(value, 4, true, "big");
403
+ }
404
+ /**
405
+ * Bit field writer. Writes 5 bits.
406
+ *
407
+ * Note: When returning to a byte write, remaining bits are dropped.
408
+ *
409
+ * @param {number} value - value as int
410
+ */
411
+ set bit5(value) {
412
+ this.bit(value, 5);
413
+ }
414
+ /**
415
+ * Bit field writer. Writes 5 bits.
416
+ *
417
+ * Note: When returning to a byte write, remaining bits are dropped.
418
+ *
419
+ * @param {number} value - value as int
420
+ */
421
+ set bit5le(value) {
422
+ this.bit(value, 5, undefined, "little");
423
+ }
424
+ /**
425
+ * Bit field writer. Writes 5 bits.
426
+ *
427
+ * Note: When returning to a byte write, remaining bits are dropped.
428
+ *
429
+ * @param {number} value - value as int
430
+ */
431
+ set bit5be(value) {
432
+ this.bit(value, 5, undefined, "big");
433
+ }
434
+ /**
435
+ * Bit field writer. Writes 5 bits.
436
+ *
437
+ * Note: When returning to a byte write, remaining bits are dropped.
438
+ *
439
+ * @param {number} value - value as int
440
+ */
441
+ set ubit5(value) {
442
+ this.bit(value, 5, true);
443
+ }
444
+ /**
445
+ * Bit field writer. Writes 5 bits.
446
+ *
447
+ * Note: When returning to a byte write, remaining bits are dropped.
448
+ *
449
+ * @param {number} value - value as int
450
+ */
451
+ set ubit5le(value) {
452
+ this.bit(value, 5, true, "little");
453
+ ;
454
+ }
455
+ /**
456
+ * Bit field writer. Writes 5 bits.
457
+ *
458
+ * Note: When returning to a byte write, remaining bits are dropped.
459
+ *
460
+ * @param {number} value - value as int
461
+ */
462
+ set ubit5be(value) {
463
+ this.bit(value, 5, true, "big");
464
+ }
465
+ /**
466
+ * Bit field writer. Writes 6 bits.
467
+ *
468
+ * Note: When returning to a byte write, remaining bits are dropped.
469
+ *
470
+ * @param {number} value - value as int
471
+ */
472
+ set bit6(value) {
473
+ this.bit(value, 6);
474
+ }
475
+ /**
476
+ * Bit field writer. Writes 6 bits.
477
+ *
478
+ * Note: When returning to a byte write, remaining bits are dropped.
479
+ *
480
+ * @param {number} value - value as int
481
+ */
482
+ set bit6le(value) {
483
+ this.bit(value, 6, undefined, "little");
484
+ }
485
+ /**
486
+ * Bit field writer. Writes 6 bits.
487
+ *
488
+ * Note: When returning to a byte write, remaining bits are dropped.
489
+ *
490
+ * @param {number} value - value as int
491
+ */
492
+ set bit6be(value) {
493
+ this.bit(value, 6, undefined, "big");
494
+ }
495
+ /**
496
+ * Bit field writer. Writes 6 bits.
497
+ *
498
+ * Note: When returning to a byte write, remaining bits are dropped.
499
+ *
500
+ * @param {number} value - value as int
501
+ */
502
+ set ubit6(value) {
503
+ this.bit(value, 6, true);
504
+ }
505
+ /**
506
+ * Bit field writer. Writes 6 bits.
507
+ *
508
+ * Note: When returning to a byte write, remaining bits are dropped.
509
+ *
510
+ * @param {number} value - value as int
511
+ */
512
+ set ubit6le(value) {
513
+ this.bit(value, 6, true, "little");
514
+ ;
515
+ }
516
+ /**
517
+ * Bit field writer. Writes 6 bits.
518
+ *
519
+ * Note: When returning to a byte write, remaining bits are dropped.
520
+ *
521
+ * @param {number} value - value as int
522
+ */
523
+ set ubit6be(value) {
524
+ this.bit(value, 6, true, "big");
525
+ }
526
+ /**
527
+ * Bit field writer. Writes 7 bits.
528
+ *
529
+ * Note: When returning to a byte write, remaining bits are dropped.
530
+ *
531
+ * @param {number} value - value as int
532
+ */
533
+ set bit7(value) {
534
+ this.bit(value, 7);
535
+ }
536
+ /**
537
+ * Bit field writer. Writes 7 bits.
538
+ *
539
+ * Note: When returning to a byte write, remaining bits are dropped.
540
+ *
541
+ * @param {number} value - value as int
542
+ */
543
+ set bit7le(value) {
544
+ this.bit(value, 7, undefined, "little");
545
+ }
546
+ /**
547
+ * Bit field writer. Writes 7 bits.
548
+ *
549
+ * Note: When returning to a byte write, remaining bits are dropped.
550
+ *
551
+ * @param {number} value - value as int
552
+ */
553
+ set bit7be(value) {
554
+ this.bit(value, 7, undefined, "big");
555
+ }
556
+ /**
557
+ * Bit field writer. Writes 7 bits.
558
+ *
559
+ * Note: When returning to a byte write, remaining bits are dropped.
560
+ *
561
+ * @param {number} value - value as int
562
+ */
563
+ set ubit7(value) {
564
+ this.bit(value, 7, true);
565
+ }
566
+ /**
567
+ * Bit field writer. Writes 7 bits.
568
+ *
569
+ * Note: When returning to a byte write, remaining bits are dropped.
570
+ *
571
+ * @param {number} value - value as int
572
+ */
573
+ set ubit7le(value) {
574
+ this.bit(value, 7, true, "little");
575
+ ;
576
+ }
577
+ /**
578
+ * Bit field writer. Writes 7 bits.
579
+ *
580
+ * Note: When returning to a byte write, remaining bits are dropped.
581
+ *
582
+ * @param {number} value - value as int
583
+ */
584
+ set ubit7be(value) {
585
+ this.bit(value, 7, true, "big");
586
+ }
587
+ /**
588
+ * Bit field writer. Writes 8 bits.
589
+ *
590
+ * Note: When returning to a byte write, remaining bits are dropped.
591
+ *
592
+ * @param {number} value - value as int
593
+ */
594
+ set bit8(value) {
595
+ this.bit(value, 8);
596
+ }
597
+ /**
598
+ * Bit field writer. Writes 8 bits.
599
+ *
600
+ * Note: When returning to a byte write, remaining bits are dropped.
601
+ *
602
+ * @param {number} value - value as int
603
+ */
604
+ set bit8le(value) {
605
+ this.bit(value, 8, undefined, "little");
606
+ }
607
+ /**
608
+ * Bit field writer. Writes 8 bits.
609
+ *
610
+ * Note: When returning to a byte write, remaining bits are dropped.
611
+ *
612
+ * @param {number} value - value as int
613
+ */
614
+ set bit8be(value) {
615
+ this.bit(value, 8, undefined, "big");
616
+ }
617
+ /**
618
+ * Bit field writer. Writes 8 bits.
619
+ *
620
+ * Note: When returning to a byte write, remaining bits are dropped.
621
+ *
622
+ * @param {number} value - value as int
623
+ */
624
+ set ubit8(value) {
625
+ this.bit(value, 8, true);
626
+ }
627
+ /**
628
+ * Bit field writer. Writes 8 bits.
629
+ *
630
+ * Note: When returning to a byte write, remaining bits are dropped.
631
+ *
632
+ * @param {number} value - value as int
633
+ */
634
+ set ubit8le(value) {
635
+ this.bit(value, 8, true, "little");
636
+ ;
637
+ }
638
+ /**
639
+ * Bit field writer. Writes 8 bits.
640
+ *
641
+ * Note: When returning to a byte write, remaining bits are dropped.
642
+ *
643
+ * @param {number} value - value as int
644
+ */
645
+ set ubit8be(value) {
646
+ this.bit(value, 8, true, "big");
647
+ }
648
+ /**
649
+ * Bit field writer. Writes 9 bits.
650
+ *
651
+ * Note: When returning to a byte write, remaining bits are dropped.
652
+ *
653
+ * @param {number} value - value as int
654
+ */
655
+ set bit9(value) {
656
+ this.bit(value, 9);
657
+ }
658
+ /**
659
+ * Bit field writer. Writes 9 bits.
660
+ *
661
+ * Note: When returning to a byte write, remaining bits are dropped.
662
+ *
663
+ * @param {number} value - value as int
664
+ */
665
+ set bit9le(value) {
666
+ this.bit(value, 9, undefined, "little");
667
+ }
668
+ /**
669
+ * Bit field writer. Writes 9 bits.
670
+ *
671
+ * Note: When returning to a byte write, remaining bits are dropped.
672
+ *
673
+ * @param {number} value - value as int
674
+ */
675
+ set bit9be(value) {
676
+ this.bit(value, 9, undefined, "big");
677
+ }
678
+ /**
679
+ * Bit field writer. Writes 9 bits.
680
+ *
681
+ * Note: When returning to a byte write, remaining bits are dropped.
682
+ *
683
+ * @param {number} value - value as int
684
+ */
685
+ set ubit9(value) {
686
+ this.bit(value, 9, true);
687
+ }
688
+ /**
689
+ * Bit field writer. Writes 9 bits.
690
+ *
691
+ * Note: When returning to a byte write, remaining bits are dropped.
692
+ *
693
+ * @param {number} value - value as int
694
+ */
695
+ set ubit9le(value) {
696
+ this.bit(value, 9, true, "little");
697
+ ;
698
+ }
699
+ /**
700
+ * Bit field writer. Writes 9 bits.
701
+ *
702
+ * Note: When returning to a byte write, remaining bits are dropped.
703
+ *
704
+ * @param {number} value - value as int
705
+ */
706
+ set ubit9be(value) {
707
+ this.bit(value, 9, true, "big");
708
+ }
709
+ /**
710
+ * Bit field writer. Writes 10 bits.
711
+ *
712
+ * Note: When returning to a byte write, remaining bits are dropped.
713
+ *
714
+ * @param {number} value - value as int
715
+ */
716
+ set bit10(value) {
717
+ this.bit(value, 10);
718
+ }
719
+ /**
720
+ * Bit field writer. Writes 10 bits.
721
+ *
722
+ * Note: When returning to a byte write, remaining bits are dropped.
723
+ *
724
+ * @param {number} value - value as int
725
+ */
726
+ set bit10le(value) {
727
+ this.bit(value, 10, undefined, "little");
728
+ }
729
+ /**
730
+ * Bit field writer. Writes 10 bits.
731
+ *
732
+ * Note: When returning to a byte write, remaining bits are dropped.
733
+ *
734
+ * @param {number} value - value as int
735
+ */
736
+ set bit10be(value) {
737
+ this.bit(value, 10, undefined, "big");
738
+ }
739
+ /**
740
+ * Bit field writer. Writes 10 bits.
741
+ *
742
+ * Note: When returning to a byte write, remaining bits are dropped.
743
+ *
744
+ * @param {number} value - value as int
745
+ */
746
+ set ubit10(value) {
747
+ this.bit(value, 10, true);
748
+ }
749
+ /**
750
+ * Bit field writer. Writes 10 bits.
751
+ *
752
+ * Note: When returning to a byte write, remaining bits are dropped.
753
+ *
754
+ * @param {number} value - value as int
755
+ */
756
+ set ubit10le(value) {
757
+ this.bit(value, 10, true, "little");
758
+ ;
759
+ }
760
+ /**
761
+ * Bit field writer. Writes 10 bits.
762
+ *
763
+ * Note: When returning to a byte write, remaining bits are dropped.
764
+ *
765
+ * @param {number} value - value as int
766
+ */
767
+ set ubit10be(value) {
768
+ this.bit(value, 10, true, "big");
769
+ }
770
+ /**
771
+ * Bit field writer. Writes 11 bits.
772
+ *
773
+ * Note: When returning to a byte write, remaining bits are dropped.
774
+ *
775
+ * @param {number} value - value as int
776
+ */
777
+ set bit11(value) {
778
+ this.bit(value, 11);
779
+ }
780
+ /**
781
+ * Bit field writer. Writes 11 bits.
782
+ *
783
+ * Note: When returning to a byte write, remaining bits are dropped.
784
+ *
785
+ * @param {number} value - value as int
786
+ */
787
+ set bit11le(value) {
788
+ this.bit(value, 11, undefined, "little");
789
+ }
790
+ /**
791
+ * Bit field writer. Writes 11 bits.
792
+ *
793
+ * Note: When returning to a byte write, remaining bits are dropped.
794
+ *
795
+ * @param {number} value - value as int
796
+ */
797
+ set bit11be(value) {
798
+ this.bit(value, 11, undefined, "big");
799
+ }
800
+ /**
801
+ * Bit field writer. Writes 11 bits.
802
+ *
803
+ * Note: When returning to a byte write, remaining bits are dropped.
804
+ *
805
+ * @param {number} value - value as int
806
+ */
807
+ set ubit11(value) {
808
+ this.bit(value, 11, true);
809
+ }
810
+ /**
811
+ * Bit field writer. Writes 11 bits.
812
+ *
813
+ * Note: When returning to a byte write, remaining bits are dropped.
814
+ *
815
+ * @param {number} value - value as int
816
+ */
817
+ set ubit11le(value) {
818
+ this.bit(value, 11, true, "little");
819
+ ;
820
+ }
821
+ /**
822
+ * Bit field writer. Writes 11 bits.
823
+ *
824
+ * Note: When returning to a byte write, remaining bits are dropped.
825
+ *
826
+ * @param {number} value - value as int
827
+ */
828
+ set ubit11be(value) {
829
+ this.bit(value, 11, true, "big");
830
+ }
831
+ /**
832
+ * Bit field writer. Writes 12 bits.
833
+ *
834
+ * Note: When returning to a byte write, remaining bits are dropped.
835
+ *
836
+ * @param {number} value - value as int
837
+ */
838
+ set bit12(value) {
839
+ this.bit(value, 12);
840
+ }
841
+ /**
842
+ * Bit field writer. Writes 12 bits.
843
+ *
844
+ * Note: When returning to a byte write, remaining bits are dropped.
845
+ *
846
+ * @param {number} value - value as int
847
+ */
848
+ set bit12le(value) {
849
+ this.bit(value, 12, undefined, "little");
850
+ }
851
+ /**
852
+ * Bit field writer. Writes 12 bits.
853
+ *
854
+ * Note: When returning to a byte write, remaining bits are dropped.
855
+ *
856
+ * @param {number} value - value as int
857
+ */
858
+ set bit12be(value) {
859
+ this.bit(value, 12, undefined, "big");
860
+ }
861
+ /**
862
+ * Bit field writer. Writes 12 bits.
863
+ *
864
+ * Note: When returning to a byte write, remaining bits are dropped.
865
+ *
866
+ * @param {number} value - value as int
867
+ */
868
+ set ubit12(value) {
869
+ this.bit(value, 12, true);
870
+ }
871
+ /**
872
+ * Bit field writer. Writes 12 bits.
873
+ *
874
+ * Note: When returning to a byte write, remaining bits are dropped.
875
+ *
876
+ * @param {number} value - value as int
877
+ */
878
+ set ubit12le(value) {
879
+ this.bit(value, 12, true, "little");
880
+ ;
881
+ }
882
+ /**
883
+ * Bit field writer. Writes 12 bits.
884
+ *
885
+ * Note: When returning to a byte write, remaining bits are dropped.
886
+ *
887
+ * @param {number} value - value as int
888
+ */
889
+ set ubit12be(value) {
890
+ this.bit(value, 12, true, "big");
891
+ }
892
+ /**
893
+ * Bit field writer. Writes 13 bits.
894
+ *
895
+ * Note: When returning to a byte write, remaining bits are dropped.
896
+ *
897
+ * @param {number} value - value as int
898
+ */
899
+ set bit13(value) {
900
+ this.bit(value, 13);
901
+ }
902
+ /**
903
+ * Bit field writer. Writes 13 bits.
904
+ *
905
+ * Note: When returning to a byte write, remaining bits are dropped.
906
+ *
907
+ * @param {number} value - value as int
908
+ */
909
+ set bit13le(value) {
910
+ this.bit(value, 13, undefined, "little");
911
+ }
912
+ /**
913
+ * Bit field writer. Writes 13 bits.
914
+ *
915
+ * Note: When returning to a byte write, remaining bits are dropped.
916
+ *
917
+ * @param {number} value - value as int
918
+ */
919
+ set bit13be(value) {
920
+ this.bit(value, 13, undefined, "big");
921
+ }
922
+ /**
923
+ * Bit field writer. Writes 13 bits.
924
+ *
925
+ * Note: When returning to a byte write, remaining bits are dropped.
926
+ *
927
+ * @param {number} value - value as int
928
+ */
929
+ set ubit13(value) {
930
+ this.bit(value, 13, true);
931
+ }
932
+ /**
933
+ * Bit field writer. Writes 13 bits.
934
+ *
935
+ * Note: When returning to a byte write, remaining bits are dropped.
936
+ *
937
+ * @param {number} value - value as int
938
+ */
939
+ set ubit13le(value) {
940
+ this.bit(value, 13, true, "little");
941
+ ;
942
+ }
943
+ /**
944
+ * Bit field writer. Writes 13 bits.
945
+ *
946
+ * Note: When returning to a byte write, remaining bits are dropped.
947
+ *
948
+ * @param {number} value - value as int
949
+ */
950
+ set ubit13be(value) {
951
+ this.bit(value, 13, true, "big");
952
+ }
953
+ /**
954
+ * Bit field writer. Writes 14 bits.
955
+ *
956
+ * Note: When returning to a byte write, remaining bits are dropped.
957
+ *
958
+ * @param {number} value - value as int
959
+ */
960
+ set bit14(value) {
961
+ this.bit(value, 14);
962
+ }
963
+ /**
964
+ * Bit field writer. Writes 14 bits.
965
+ *
966
+ * Note: When returning to a byte write, remaining bits are dropped.
967
+ *
968
+ * @param {number} value - value as int
969
+ */
970
+ set bit14le(value) {
971
+ this.bit(value, 14, undefined, "little");
972
+ }
973
+ /**
974
+ * Bit field writer. Writes 14 bits.
975
+ *
976
+ * Note: When returning to a byte write, remaining bits are dropped.
977
+ *
978
+ * @param {number} value - value as int
979
+ */
980
+ set bit14be(value) {
981
+ this.bit(value, 14, undefined, "big");
982
+ }
983
+ /**
984
+ * Bit field writer. Writes 14 bits.
985
+ *
986
+ * Note: When returning to a byte write, remaining bits are dropped.
987
+ *
988
+ * @param {number} value - value as int
989
+ */
990
+ set ubit14(value) {
991
+ this.bit(value, 14, true);
992
+ }
993
+ /**
994
+ * Bit field writer. Writes 14 bits.
995
+ *
996
+ * Note: When returning to a byte write, remaining bits are dropped.
997
+ *
998
+ * @param {number} value - value as int
999
+ */
1000
+ set ubit14le(value) {
1001
+ this.bit(value, 14, true, "little");
1002
+ ;
1003
+ }
1004
+ /**
1005
+ * Bit field writer. Writes 14 bits.
1006
+ *
1007
+ * Note: When returning to a byte write, remaining bits are dropped.
1008
+ *
1009
+ * @param {number} value - value as int
1010
+ */
1011
+ set ubit14be(value) {
1012
+ this.bit(value, 14, true, "big");
1013
+ }
1014
+ /**
1015
+ * Bit field writer. Writes 15 bits.
1016
+ *
1017
+ * Note: When returning to a byte write, remaining bits are dropped.
1018
+ *
1019
+ * @param {number} value - value as int
1020
+ */
1021
+ set bit15(value) {
1022
+ this.bit(value, 15);
1023
+ }
1024
+ /**
1025
+ * Bit field writer. Writes 15 bits.
1026
+ *
1027
+ * Note: When returning to a byte write, remaining bits are dropped.
1028
+ *
1029
+ * @param {number} value - value as int
1030
+ */
1031
+ set bit15le(value) {
1032
+ this.bit(value, 15, undefined, "little");
1033
+ }
1034
+ /**
1035
+ * Bit field writer. Writes 15 bits.
1036
+ *
1037
+ * Note: When returning to a byte write, remaining bits are dropped.
1038
+ *
1039
+ * @param {number} value - value as int
1040
+ */
1041
+ set bit15be(value) {
1042
+ this.bit(value, 15, undefined, "big");
1043
+ }
1044
+ /**
1045
+ * Bit field writer. Writes 15 bits.
1046
+ *
1047
+ * Note: When returning to a byte write, remaining bits are dropped.
1048
+ *
1049
+ * @param {number} value - value as int
1050
+ */
1051
+ set ubit15(value) {
1052
+ this.bit(value, 15, true);
1053
+ }
1054
+ /**
1055
+ * Bit field writer. Writes 15 bits.
1056
+ *
1057
+ * Note: When returning to a byte write, remaining bits are dropped.
1058
+ *
1059
+ * @param {number} value - value as int
1060
+ */
1061
+ set ubit15le(value) {
1062
+ this.bit(value, 15, true, "little");
1063
+ ;
1064
+ }
1065
+ /**
1066
+ * Bit field writer. Writes 15 bits.
1067
+ *
1068
+ * Note: When returning to a byte write, remaining bits are dropped.
1069
+ *
1070
+ * @param {number} value - value as int
1071
+ */
1072
+ set ubit15be(value) {
1073
+ this.bit(value, 15, true, "big");
1074
+ }
1075
+ /**
1076
+ * Bit field writer. Writes 16 bits.
1077
+ *
1078
+ * Note: When returning to a byte write, remaining bits are dropped.
1079
+ *
1080
+ * @param {number} value - value as int
1081
+ */
1082
+ set bit16(value) {
1083
+ this.bit(value, 16);
1084
+ }
1085
+ /**
1086
+ * Bit field writer. Writes 16 bits.
1087
+ *
1088
+ * Note: When returning to a byte write, remaining bits are dropped.
1089
+ *
1090
+ * @param {number} value - value as int
1091
+ */
1092
+ set bit16le(value) {
1093
+ this.bit(value, 16, undefined, "little");
1094
+ }
1095
+ /**
1096
+ * Bit field writer. Writes 16 bits.
1097
+ *
1098
+ * Note: When returning to a byte write, remaining bits are dropped.
1099
+ *
1100
+ * @param {number} value - value as int
1101
+ */
1102
+ set bit16be(value) {
1103
+ this.bit(value, 16, undefined, "big");
1104
+ }
1105
+ /**
1106
+ * Bit field writer. Writes 16 bits.
1107
+ *
1108
+ * Note: When returning to a byte write, remaining bits are dropped.
1109
+ *
1110
+ * @param {number} value - value as int
1111
+ */
1112
+ set ubit16(value) {
1113
+ this.bit(value, 16, true);
1114
+ }
1115
+ /**
1116
+ * Bit field writer. Writes 16 bits.
1117
+ *
1118
+ * Note: When returning to a byte write, remaining bits are dropped.
1119
+ *
1120
+ * @param {number} value - value as int
1121
+ */
1122
+ set ubit16le(value) {
1123
+ this.bit(value, 16, true, "little");
1124
+ ;
1125
+ }
1126
+ /**
1127
+ * Bit field writer. Writes 16 bits.
1128
+ *
1129
+ * Note: When returning to a byte write, remaining bits are dropped.
1130
+ *
1131
+ * @param {number} value - value as int
1132
+ */
1133
+ set ubit16be(value) {
1134
+ this.bit(value, 16, true, "big");
1135
+ }
1136
+ /**
1137
+ * Bit field writer. Writes 17 bits.
1138
+ *
1139
+ * Note: When returning to a byte write, remaining bits are dropped.
1140
+ *
1141
+ * @param {number} value - value as int
1142
+ */
1143
+ set bit17(value) {
1144
+ this.bit(value, 17);
1145
+ }
1146
+ /**
1147
+ * Bit field writer. Writes 17 bits.
1148
+ *
1149
+ * Note: When returning to a byte write, remaining bits are dropped.
1150
+ *
1151
+ * @param {number} value - value as int
1152
+ */
1153
+ set bit17le(value) {
1154
+ this.bit(value, 17, undefined, "little");
1155
+ }
1156
+ /**
1157
+ * Bit field writer. Writes 17 bits.
1158
+ *
1159
+ * Note: When returning to a byte write, remaining bits are dropped.
1160
+ *
1161
+ * @param {number} value - value as int
1162
+ */
1163
+ set bit17be(value) {
1164
+ this.bit(value, 17, undefined, "big");
1165
+ }
1166
+ /**
1167
+ * Bit field writer. Writes 17 bits.
1168
+ *
1169
+ * Note: When returning to a byte write, remaining bits are dropped.
1170
+ *
1171
+ * @param {number} value - value as int
1172
+ */
1173
+ set ubit17(value) {
1174
+ this.bit(value, 17, true);
1175
+ }
1176
+ /**
1177
+ * Bit field writer. Writes 17 bits.
1178
+ *
1179
+ * Note: When returning to a byte write, remaining bits are dropped.
1180
+ *
1181
+ * @param {number} value - value as int
1182
+ */
1183
+ set ubit17le(value) {
1184
+ this.bit(value, 17, true, "little");
1185
+ ;
1186
+ }
1187
+ /**
1188
+ * Bit field writer. Writes 17 bits.
1189
+ *
1190
+ * Note: When returning to a byte write, remaining bits are dropped.
1191
+ *
1192
+ * @param {number} value - value as int
1193
+ */
1194
+ set ubit17be(value) {
1195
+ this.bit(value, 17, true, "big");
1196
+ }
1197
+ /**
1198
+ * Bit field writer. Writes 18 bits.
1199
+ *
1200
+ * Note: When returning to a byte write, remaining bits are dropped.
1201
+ *
1202
+ * @param {number} value - value as int
1203
+ */
1204
+ set bit18(value) {
1205
+ this.bit(value, 18);
1206
+ }
1207
+ /**
1208
+ * Bit field writer. Writes 18 bits.
1209
+ *
1210
+ * Note: When returning to a byte write, remaining bits are dropped.
1211
+ *
1212
+ * @param {number} value - value as int
1213
+ */
1214
+ set bit18le(value) {
1215
+ this.bit(value, 18, undefined, "little");
1216
+ }
1217
+ /**
1218
+ * Bit field writer. Writes 18 bits.
1219
+ *
1220
+ * Note: When returning to a byte write, remaining bits are dropped.
1221
+ *
1222
+ * @param {number} value - value as int
1223
+ */
1224
+ set bit18be(value) {
1225
+ this.bit(value, 18, undefined, "big");
1226
+ }
1227
+ /**
1228
+ * Bit field writer. Writes 18 bits.
1229
+ *
1230
+ * Note: When returning to a byte write, remaining bits are dropped.
1231
+ *
1232
+ * @param {number} value - value as int
1233
+ */
1234
+ set ubit18(value) {
1235
+ this.bit(value, 18, true);
1236
+ }
1237
+ /**
1238
+ * Bit field writer. Writes 18 bits.
1239
+ *
1240
+ * Note: When returning to a byte write, remaining bits are dropped.
1241
+ *
1242
+ * @param {number} value - value as int
1243
+ */
1244
+ set ubit18le(value) {
1245
+ this.bit(value, 18, true, "little");
1246
+ ;
1247
+ }
1248
+ /**
1249
+ * Bit field writer. Writes 18 bits.
1250
+ *
1251
+ * Note: When returning to a byte write, remaining bits are dropped.
1252
+ *
1253
+ * @param {number} value - value as int
1254
+ */
1255
+ set ubit18be(value) {
1256
+ this.bit(value, 18, true, "big");
1257
+ }
1258
+ /**
1259
+ * Bit field writer. Writes 19 bits.
1260
+ *
1261
+ * Note: When returning to a byte write, remaining bits are dropped.
1262
+ *
1263
+ * @param {number} value - value as int
1264
+ */
1265
+ set bit19(value) {
1266
+ this.bit(value, 19);
1267
+ }
1268
+ /**
1269
+ * Bit field writer. Writes 19 bits.
1270
+ *
1271
+ * Note: When returning to a byte write, remaining bits are dropped.
1272
+ *
1273
+ * @param {number} value - value as int
1274
+ */
1275
+ set bit19le(value) {
1276
+ this.bit(value, 19, undefined, "little");
1277
+ }
1278
+ /**
1279
+ * Bit field writer. Writes 19 bits.
1280
+ *
1281
+ * Note: When returning to a byte write, remaining bits are dropped.
1282
+ *
1283
+ * @param {number} value - value as int
1284
+ */
1285
+ set bit19be(value) {
1286
+ this.bit(value, 19, undefined, "big");
1287
+ }
1288
+ /**
1289
+ * Bit field writer. Writes 19 bits.
1290
+ *
1291
+ * Note: When returning to a byte write, remaining bits are dropped.
1292
+ *
1293
+ * @param {number} value - value as int
1294
+ */
1295
+ set ubit19(value) {
1296
+ this.bit(value, 19, true);
1297
+ }
1298
+ /**
1299
+ * Bit field writer. Writes 19 bits.
1300
+ *
1301
+ * Note: When returning to a byte write, remaining bits are dropped.
1302
+ *
1303
+ * @param {number} value - value as int
1304
+ */
1305
+ set ubit19le(value) {
1306
+ this.bit(value, 19, true, "little");
1307
+ ;
1308
+ }
1309
+ /**
1310
+ * Bit field writer. Writes 19 bits.
1311
+ *
1312
+ * Note: When returning to a byte write, remaining bits are dropped.
1313
+ *
1314
+ * @param {number} value - value as int
1315
+ */
1316
+ set ubit19be(value) {
1317
+ this.bit(value, 19, true, "big");
1318
+ }
1319
+ /**
1320
+ * Bit field writer. Writes 20 bits.
1321
+ *
1322
+ * Note: When returning to a byte write, remaining bits are dropped.
1323
+ *
1324
+ * @param {number} value - value as int
1325
+ */
1326
+ set bit20(value) {
1327
+ this.bit(value, 20);
1328
+ }
1329
+ /**
1330
+ * Bit field writer. Writes 20 bits.
1331
+ *
1332
+ * Note: When returning to a byte write, remaining bits are dropped.
1333
+ *
1334
+ * @param {number} value - value as int
1335
+ */
1336
+ set bit20le(value) {
1337
+ this.bit(value, 20, undefined, "little");
1338
+ }
1339
+ /**
1340
+ * Bit field writer. Writes 20 bits.
1341
+ *
1342
+ * Note: When returning to a byte write, remaining bits are dropped.
1343
+ *
1344
+ * @param {number} value - value as int
1345
+ */
1346
+ set bit20be(value) {
1347
+ this.bit(value, 20, undefined, "big");
1348
+ }
1349
+ /**
1350
+ * Bit field writer. Writes 20 bits.
1351
+ *
1352
+ * Note: When returning to a byte write, remaining bits are dropped.
1353
+ *
1354
+ * @param {number} value - value as int
1355
+ */
1356
+ set ubit20(value) {
1357
+ this.bit(value, 20, true);
1358
+ }
1359
+ /**
1360
+ * Bit field writer. Writes 20 bits.
1361
+ *
1362
+ * Note: When returning to a byte write, remaining bits are dropped.
1363
+ *
1364
+ * @param {number} value - value as int
1365
+ */
1366
+ set ubit20le(value) {
1367
+ this.bit(value, 20, true, "little");
1368
+ ;
1369
+ }
1370
+ /**
1371
+ * Bit field writer. Writes 20 bits.
1372
+ *
1373
+ * Note: When returning to a byte write, remaining bits are dropped.
1374
+ *
1375
+ * @param {number} value - value as int
1376
+ */
1377
+ set ubit20be(value) {
1378
+ this.bit(value, 20, true, "big");
1379
+ }
1380
+ /**
1381
+ * Bit field writer. Writes 21 bits.
1382
+ *
1383
+ * Note: When returning to a byte write, remaining bits are dropped.
1384
+ *
1385
+ * @param {number} value - value as int
1386
+ */
1387
+ set bit21(value) {
1388
+ this.bit(value, 21);
1389
+ }
1390
+ /**
1391
+ * Bit field writer. Writes 21 bits.
1392
+ *
1393
+ * Note: When returning to a byte write, remaining bits are dropped.
1394
+ *
1395
+ * @param {number} value - value as int
1396
+ */
1397
+ set bit21le(value) {
1398
+ this.bit(value, 21, undefined, "little");
1399
+ }
1400
+ /**
1401
+ * Bit field writer. Writes 21 bits.
1402
+ *
1403
+ * Note: When returning to a byte write, remaining bits are dropped.
1404
+ *
1405
+ * @param {number} value - value as int
1406
+ */
1407
+ set bit21be(value) {
1408
+ this.bit(value, 21, undefined, "big");
1409
+ }
1410
+ /**
1411
+ * Bit field writer. Writes 21 bits.
1412
+ *
1413
+ * Note: When returning to a byte write, remaining bits are dropped.
1414
+ *
1415
+ * @param {number} value - value as int
1416
+ */
1417
+ set ubit21(value) {
1418
+ this.bit(value, 21, true);
1419
+ }
1420
+ /**
1421
+ * Bit field writer. Writes 21 bits.
1422
+ *
1423
+ * Note: When returning to a byte write, remaining bits are dropped.
1424
+ *
1425
+ * @param {number} value - value as int
1426
+ */
1427
+ set ubit21le(value) {
1428
+ this.bit(value, 21, true, "little");
1429
+ ;
1430
+ }
1431
+ /**
1432
+ * Bit field writer. Writes 21 bits.
1433
+ *
1434
+ * Note: When returning to a byte write, remaining bits are dropped.
1435
+ *
1436
+ * @param {number} value - value as int
1437
+ */
1438
+ set ubit21be(value) {
1439
+ this.bit(value, 21, true, "big");
1440
+ }
1441
+ /**
1442
+ * Bit field writer. Writes 22 bits.
1443
+ *
1444
+ * Note: When returning to a byte write, remaining bits are dropped.
1445
+ *
1446
+ * @param {number} value - value as int
1447
+ */
1448
+ set bit22(value) {
1449
+ this.bit(value, 22);
1450
+ }
1451
+ /**
1452
+ * Bit field writer. Writes 22 bits.
1453
+ *
1454
+ * Note: When returning to a byte write, remaining bits are dropped.
1455
+ *
1456
+ * @param {number} value - value as int
1457
+ */
1458
+ set bit22le(value) {
1459
+ this.bit(value, 22, undefined, "little");
1460
+ }
1461
+ /**
1462
+ * Bit field writer. Writes 22 bits.
1463
+ *
1464
+ * Note: When returning to a byte write, remaining bits are dropped.
1465
+ *
1466
+ * @param {number} value - value as int
1467
+ */
1468
+ set bit22be(value) {
1469
+ this.bit(value, 22, undefined, "big");
1470
+ }
1471
+ /**
1472
+ * Bit field writer. Writes 22 bits.
1473
+ *
1474
+ * Note: When returning to a byte write, remaining bits are dropped.
1475
+ *
1476
+ * @param {number} value - value as int
1477
+ */
1478
+ set ubit22(value) {
1479
+ this.bit(value, 22, true);
1480
+ }
1481
+ /**
1482
+ * Bit field writer. Writes 22 bits.
1483
+ *
1484
+ * Note: When returning to a byte write, remaining bits are dropped.
1485
+ *
1486
+ * @param {number} value - value as int
1487
+ */
1488
+ set ubit22le(value) {
1489
+ this.bit(value, 22, true, "little");
1490
+ ;
1491
+ }
1492
+ /**
1493
+ * Bit field writer. Writes 22 bits.
1494
+ *
1495
+ * Note: When returning to a byte write, remaining bits are dropped.
1496
+ *
1497
+ * @param {number} value - value as int
1498
+ */
1499
+ set ubit22be(value) {
1500
+ this.bit(value, 22, true, "big");
1501
+ }
1502
+ /**
1503
+ * Bit field writer. Writes 23 bits.
1504
+ *
1505
+ * Note: When returning to a byte write, remaining bits are dropped.
1506
+ *
1507
+ * @param {number} value - value as int
1508
+ */
1509
+ set bit23(value) {
1510
+ this.bit(value, 23);
1511
+ }
1512
+ /**
1513
+ * Bit field writer. Writes 23 bits.
1514
+ *
1515
+ * Note: When returning to a byte write, remaining bits are dropped.
1516
+ *
1517
+ * @param {number} value - value as int
1518
+ */
1519
+ set bit23le(value) {
1520
+ this.bit(value, 23, undefined, "little");
1521
+ }
1522
+ /**
1523
+ * Bit field writer. Writes 23 bits.
1524
+ *
1525
+ * Note: When returning to a byte write, remaining bits are dropped.
1526
+ *
1527
+ * @param {number} value - value as int
1528
+ */
1529
+ set bit23be(value) {
1530
+ this.bit(value, 23, undefined, "big");
1531
+ }
1532
+ /**
1533
+ * Bit field writer. Writes 23 bits.
1534
+ *
1535
+ * Note: When returning to a byte write, remaining bits are dropped.
1536
+ *
1537
+ * @param {number} value - value as int
1538
+ */
1539
+ set ubit23(value) {
1540
+ this.bit(value, 23, true);
1541
+ }
1542
+ /**
1543
+ * Bit field writer. Writes 23 bits.
1544
+ *
1545
+ * Note: When returning to a byte write, remaining bits are dropped.
1546
+ *
1547
+ * @param {number} value - value as int
1548
+ */
1549
+ set ubit23le(value) {
1550
+ this.bit(value, 23, true, "little");
1551
+ ;
1552
+ }
1553
+ /**
1554
+ * Bit field writer. Writes 23 bits.
1555
+ *
1556
+ * Note: When returning to a byte write, remaining bits are dropped.
1557
+ *
1558
+ * @param {number} value - value as int
1559
+ */
1560
+ set ubit23be(value) {
1561
+ this.bit(value, 23, true, "big");
1562
+ }
1563
+ /**
1564
+ * Bit field writer. Writes 24 bits.
1565
+ *
1566
+ * Note: When returning to a byte write, remaining bits are dropped.
1567
+ *
1568
+ * @param {number} value - value as int
1569
+ */
1570
+ set bit24(value) {
1571
+ this.bit(value, 24);
1572
+ }
1573
+ /**
1574
+ * Bit field writer. Writes 24 bits.
1575
+ *
1576
+ * Note: When returning to a byte write, remaining bits are dropped.
1577
+ *
1578
+ * @param {number} value - value as int
1579
+ */
1580
+ set bit24le(value) {
1581
+ this.bit(value, 24, undefined, "little");
1582
+ }
1583
+ /**
1584
+ * Bit field writer. Writes 24 bits.
1585
+ *
1586
+ * Note: When returning to a byte write, remaining bits are dropped.
1587
+ *
1588
+ * @param {number} value - value as int
1589
+ */
1590
+ set bit24be(value) {
1591
+ this.bit(value, 24, undefined, "big");
1592
+ }
1593
+ /**
1594
+ * Bit field writer. Writes 24 bits.
1595
+ *
1596
+ * Note: When returning to a byte write, remaining bits are dropped.
1597
+ *
1598
+ * @param {number} value - value as int
1599
+ */
1600
+ set ubit24(value) {
1601
+ this.bit(value, 24, true);
1602
+ }
1603
+ /**
1604
+ * Bit field writer. Writes 24 bits.
1605
+ *
1606
+ * Note: When returning to a byte write, remaining bits are dropped.
1607
+ *
1608
+ * @param {number} value - value as int
1609
+ */
1610
+ set ubit24le(value) {
1611
+ this.bit(value, 24, true, "little");
1612
+ ;
1613
+ }
1614
+ /**
1615
+ * Bit field writer. Writes 24 bits.
1616
+ *
1617
+ * Note: When returning to a byte write, remaining bits are dropped.
1618
+ *
1619
+ * @param {number} value - value as int
1620
+ */
1621
+ set ubit24be(value) {
1622
+ this.bit(value, 24, true, "big");
1623
+ }
1624
+ /**
1625
+ * Bit field writer. Writes 25 bits.
1626
+ *
1627
+ * Note: When returning to a byte write, remaining bits are dropped.
1628
+ *
1629
+ * @param {number} value - value as int
1630
+ */
1631
+ set bit25(value) {
1632
+ this.bit(value, 25);
1633
+ }
1634
+ /**
1635
+ * Bit field writer. Writes 25 bits.
1636
+ *
1637
+ * Note: When returning to a byte write, remaining bits are dropped.
1638
+ *
1639
+ * @param {number} value - value as int
1640
+ */
1641
+ set bit25le(value) {
1642
+ this.bit(value, 25, undefined, "little");
1643
+ }
1644
+ /**
1645
+ * Bit field writer. Writes 25 bits.
1646
+ *
1647
+ * Note: When returning to a byte write, remaining bits are dropped.
1648
+ *
1649
+ * @param {number} value - value as int
1650
+ */
1651
+ set bit25be(value) {
1652
+ this.bit(value, 25, undefined, "big");
1653
+ }
1654
+ /**
1655
+ * Bit field writer. Writes 25 bits.
1656
+ *
1657
+ * Note: When returning to a byte write, remaining bits are dropped.
1658
+ *
1659
+ * @param {number} value - value as int
1660
+ */
1661
+ set ubit25(value) {
1662
+ this.bit(value, 25, true);
1663
+ }
1664
+ /**
1665
+ * Bit field writer. Writes 25 bits.
1666
+ *
1667
+ * Note: When returning to a byte write, remaining bits are dropped.
1668
+ *
1669
+ * @param {number} value - value as int
1670
+ */
1671
+ set ubit25le(value) {
1672
+ this.bit(value, 25, true, "little");
1673
+ ;
1674
+ }
1675
+ /**
1676
+ * Bit field writer. Writes 25 bits.
1677
+ *
1678
+ * Note: When returning to a byte write, remaining bits are dropped.
1679
+ *
1680
+ * @param {number} value - value as int
1681
+ */
1682
+ set ubit25be(value) {
1683
+ this.bit(value, 25, true, "big");
1684
+ }
1685
+ /**
1686
+ * Bit field writer. Writes 26 bits.
1687
+ *
1688
+ * Note: When returning to a byte write, remaining bits are dropped.
1689
+ *
1690
+ * @param {number} value - value as int
1691
+ */
1692
+ set bit26(value) {
1693
+ this.bit(value, 26);
1694
+ }
1695
+ /**
1696
+ * Bit field writer. Writes 26 bits.
1697
+ *
1698
+ * Note: When returning to a byte write, remaining bits are dropped.
1699
+ *
1700
+ * @param {number} value - value as int
1701
+ */
1702
+ set bit26le(value) {
1703
+ this.bit(value, 26, undefined, "little");
1704
+ }
1705
+ /**
1706
+ * Bit field writer. Writes 26 bits.
1707
+ *
1708
+ * Note: When returning to a byte write, remaining bits are dropped.
1709
+ *
1710
+ * @param {number} value - value as int
1711
+ */
1712
+ set bit26be(value) {
1713
+ this.bit(value, 26, undefined, "big");
1714
+ }
1715
+ /**
1716
+ * Bit field writer. Writes 26 bits.
1717
+ *
1718
+ * Note: When returning to a byte write, remaining bits are dropped.
1719
+ *
1720
+ * @param {number} value - value as int
1721
+ */
1722
+ set ubit26(value) {
1723
+ this.bit(value, 26, true);
1724
+ }
1725
+ /**
1726
+ * Bit field writer. Writes 26 bits.
1727
+ *
1728
+ * Note: When returning to a byte write, remaining bits are dropped.
1729
+ *
1730
+ * @param {number} value - value as int
1731
+ */
1732
+ set ubit26le(value) {
1733
+ this.bit(value, 26, true, "little");
1734
+ ;
1735
+ }
1736
+ /**
1737
+ * Bit field writer. Writes 26 bits.
1738
+ *
1739
+ * Note: When returning to a byte write, remaining bits are dropped.
1740
+ *
1741
+ * @param {number} value - value as int
1742
+ */
1743
+ set ubit26be(value) {
1744
+ this.bit(value, 26, true, "big");
1745
+ }
1746
+ /**
1747
+ * Bit field writer. Writes 27 bits.
1748
+ *
1749
+ * Note: When returning to a byte write, remaining bits are dropped.
1750
+ *
1751
+ * @param {number} value - value as int
1752
+ */
1753
+ set bit27(value) {
1754
+ this.bit(value, 27);
1755
+ }
1756
+ /**
1757
+ * Bit field writer. Writes 27 bits.
1758
+ *
1759
+ * Note: When returning to a byte write, remaining bits are dropped.
1760
+ *
1761
+ * @param {number} value - value as int
1762
+ */
1763
+ set bit27le(value) {
1764
+ this.bit(value, 27, undefined, "little");
1765
+ }
1766
+ /**
1767
+ * Bit field writer. Writes 27 bits.
1768
+ *
1769
+ * Note: When returning to a byte write, remaining bits are dropped.
1770
+ *
1771
+ * @param {number} value - value as int
1772
+ */
1773
+ set bit27be(value) {
1774
+ this.bit(value, 27, undefined, "big");
1775
+ }
1776
+ /**
1777
+ * Bit field writer. Writes 27 bits.
1778
+ *
1779
+ * Note: When returning to a byte write, remaining bits are dropped.
1780
+ *
1781
+ * @param {number} value - value as int
1782
+ */
1783
+ set ubit27(value) {
1784
+ this.bit(value, 27, true);
1785
+ }
1786
+ /**
1787
+ * Bit field writer. Writes 27 bits.
1788
+ *
1789
+ * Note: When returning to a byte write, remaining bits are dropped.
1790
+ *
1791
+ * @param {number} value - value as int
1792
+ */
1793
+ set ubit27le(value) {
1794
+ this.bit(value, 27, true, "little");
1795
+ ;
1796
+ }
1797
+ /**
1798
+ * Bit field writer. Writes 27 bits.
1799
+ *
1800
+ * Note: When returning to a byte write, remaining bits are dropped.
1801
+ *
1802
+ * @param {number} value - value as int
1803
+ */
1804
+ set ubit27be(value) {
1805
+ this.bit(value, 27, true, "big");
1806
+ }
1807
+ /**
1808
+ * Bit field writer. Writes 28 bits.
1809
+ *
1810
+ * Note: When returning to a byte write, remaining bits are dropped.
1811
+ *
1812
+ * @param {number} value - value as int
1813
+ */
1814
+ set bit28(value) {
1815
+ this.bit(value, 28);
1816
+ }
1817
+ /**
1818
+ * Bit field writer. Writes 28 bits.
1819
+ *
1820
+ * Note: When returning to a byte write, remaining bits are dropped.
1821
+ *
1822
+ * @param {number} value - value as int
1823
+ */
1824
+ set bit28le(value) {
1825
+ this.bit(value, 28, undefined, "little");
1826
+ }
1827
+ /**
1828
+ * Bit field writer. Writes 28 bits.
1829
+ *
1830
+ * Note: When returning to a byte write, remaining bits are dropped.
1831
+ *
1832
+ * @param {number} value - value as int
1833
+ */
1834
+ set bit28be(value) {
1835
+ this.bit(value, 28, undefined, "big");
1836
+ }
1837
+ /**
1838
+ * Bit field writer. Writes 28 bits.
1839
+ *
1840
+ * Note: When returning to a byte write, remaining bits are dropped.
1841
+ *
1842
+ * @param {number} value - value as int
1843
+ */
1844
+ set ubit28(value) {
1845
+ this.bit(value, 28, true);
1846
+ }
1847
+ /**
1848
+ * Bit field writer. Writes 28 bits.
1849
+ *
1850
+ * Note: When returning to a byte write, remaining bits are dropped.
1851
+ *
1852
+ * @param {number} value - value as int
1853
+ */
1854
+ set ubit28le(value) {
1855
+ this.bit(value, 28, true, "little");
1856
+ ;
1857
+ }
1858
+ /**
1859
+ * Bit field writer. Writes 28 bits.
1860
+ *
1861
+ * Note: When returning to a byte write, remaining bits are dropped.
1862
+ *
1863
+ * @param {number} value - value as int
1864
+ */
1865
+ set ubit28be(value) {
1866
+ this.bit(value, 28, true, "big");
1867
+ }
1868
+ /**
1869
+ * Bit field writer. Writes 29 bits.
1870
+ *
1871
+ * Note: When returning to a byte write, remaining bits are dropped.
1872
+ *
1873
+ * @param {number} value - value as int
1874
+ */
1875
+ set bit29(value) {
1876
+ this.bit(value, 29);
1877
+ }
1878
+ /**
1879
+ * Bit field writer. Writes 29 bits.
1880
+ *
1881
+ * Note: When returning to a byte write, remaining bits are dropped.
1882
+ *
1883
+ * @param {number} value - value as int
1884
+ */
1885
+ set bit29le(value) {
1886
+ this.bit(value, 29, undefined, "little");
1887
+ }
1888
+ /**
1889
+ * Bit field writer. Writes 29 bits.
1890
+ *
1891
+ * Note: When returning to a byte write, remaining bits are dropped.
1892
+ *
1893
+ * @param {number} value - value as int
1894
+ */
1895
+ set bit29be(value) {
1896
+ this.bit(value, 29, undefined, "big");
1897
+ }
1898
+ /**
1899
+ * Bit field writer. Writes 29 bits.
1900
+ *
1901
+ * Note: When returning to a byte write, remaining bits are dropped.
1902
+ *
1903
+ * @param {number} value - value as int
1904
+ */
1905
+ set ubit29(value) {
1906
+ this.bit(value, 29, true);
1907
+ }
1908
+ /**
1909
+ * Bit field writer. Writes 29 bits.
1910
+ *
1911
+ * Note: When returning to a byte write, remaining bits are dropped.
1912
+ *
1913
+ * @param {number} value - value as int
1914
+ */
1915
+ set ubit29le(value) {
1916
+ this.bit(value, 29, true, "little");
1917
+ ;
1918
+ }
1919
+ /**
1920
+ * Bit field writer. Writes 29 bits.
1921
+ *
1922
+ * Note: When returning to a byte write, remaining bits are dropped.
1923
+ *
1924
+ * @param {number} value - value as int
1925
+ */
1926
+ set ubit29be(value) {
1927
+ this.bit(value, 29, true, "big");
1928
+ }
1929
+ /**
1930
+ * Bit field writer. Writes 30 bits.
1931
+ *
1932
+ * Note: When returning to a byte write, remaining bits are dropped.
1933
+ *
1934
+ * @param {number} value - value as int
1935
+ */
1936
+ set bit30(value) {
1937
+ this.bit(value, 30);
1938
+ }
1939
+ /**
1940
+ * Bit field writer. Writes 30 bits.
1941
+ *
1942
+ * Note: When returning to a byte write, remaining bits are dropped.
1943
+ *
1944
+ * @param {number} value - value as int
1945
+ */
1946
+ set bit30le(value) {
1947
+ this.bit(value, 30, undefined, "little");
1948
+ }
1949
+ /**
1950
+ * Bit field writer. Writes 30 bits.
1951
+ *
1952
+ * Note: When returning to a byte write, remaining bits are dropped.
1953
+ *
1954
+ * @param {number} value - value as int
1955
+ */
1956
+ set bit30be(value) {
1957
+ this.bit(value, 30, undefined, "big");
1958
+ }
1959
+ /**
1960
+ * Bit field writer. Writes 30 bits.
1961
+ *
1962
+ * Note: When returning to a byte write, remaining bits are dropped.
1963
+ *
1964
+ * @param {number} value - value as int
1965
+ */
1966
+ set ubit30(value) {
1967
+ this.bit(value, 30, true);
1968
+ }
1969
+ /**
1970
+ * Bit field writer. Writes 30 bits.
1971
+ *
1972
+ * Note: When returning to a byte write, remaining bits are dropped.
1973
+ *
1974
+ * @param {number} value - value as int
1975
+ */
1976
+ set ubit30le(value) {
1977
+ this.bit(value, 30, true, "little");
1978
+ ;
1979
+ }
1980
+ /**
1981
+ * Bit field writer. Writes 30 bits.
1982
+ *
1983
+ * Note: When returning to a byte write, remaining bits are dropped.
1984
+ *
1985
+ * @param {number} value - value as int
1986
+ */
1987
+ set ubit30be(value) {
1988
+ this.bit(value, 30, true, "big");
1989
+ }
1990
+ /**
1991
+ * Bit field writer. Writes 31 bits.
1992
+ *
1993
+ * Note: When returning to a byte write, remaining bits are dropped.
1994
+ *
1995
+ * @param {number} value - value as int
1996
+ */
1997
+ set bit31(value) {
1998
+ this.bit(value, 31);
1999
+ }
2000
+ /**
2001
+ * Bit field writer. Writes 31 bits.
2002
+ *
2003
+ * Note: When returning to a byte write, remaining bits are dropped.
2004
+ *
2005
+ * @param {number} value - value as int
2006
+ */
2007
+ set bit31le(value) {
2008
+ this.bit(value, 31, undefined, "little");
2009
+ }
2010
+ /**
2011
+ * Bit field writer. Writes 31 bits.
2012
+ *
2013
+ * Note: When returning to a byte write, remaining bits are dropped.
2014
+ *
2015
+ * @param {number} value - value as int
2016
+ */
2017
+ set bit31be(value) {
2018
+ this.bit(value, 31, undefined, "big");
2019
+ }
2020
+ /**
2021
+ * Bit field writer. Writes 31 bits.
2022
+ *
2023
+ * Note: When returning to a byte write, remaining bits are dropped.
2024
+ *
2025
+ * @param {number} value - value as int
2026
+ */
2027
+ set ubit31(value) {
2028
+ this.bit(value, 31, true);
2029
+ }
2030
+ /**
2031
+ * Bit field writer. Writes 31 bits.
2032
+ *
2033
+ * Note: When returning to a byte write, remaining bits are dropped.
2034
+ *
2035
+ * @param {number} value - value as int
2036
+ */
2037
+ set ubit31le(value) {
2038
+ this.bit(value, 31, true, "little");
2039
+ ;
2040
+ }
2041
+ /**
2042
+ * Bit field writer. Writes 31 bits.
2043
+ *
2044
+ * Note: When returning to a byte write, remaining bits are dropped.
2045
+ *
2046
+ * @param {number} value - value as int
2047
+ */
2048
+ set ubit31be(value) {
2049
+ this.bit(value, 31, true, "big");
2050
+ }
2051
+ /**
2052
+ * Bit field writer. Writes 32 bits.
2053
+ *
2054
+ * Note: When returning to a byte write, remaining bits are dropped.
2055
+ *
2056
+ * @param {number} value - value as int
2057
+ */
2058
+ set bit32(value) {
2059
+ this.bit(value, 32);
2060
+ }
2061
+ /**
2062
+ * Bit field writer. Writes 32 bits.
2063
+ *
2064
+ * Note: When returning to a byte write, remaining bits are dropped.
2065
+ *
2066
+ * @param {number} value - value as int
2067
+ */
2068
+ set bit32le(value) {
2069
+ this.bit(value, 32, undefined, "little");
2070
+ }
2071
+ /**
2072
+ * Bit field writer. Writes 32 bits.
2073
+ *
2074
+ * Note: When returning to a byte write, remaining bits are dropped.
2075
+ *
2076
+ * @param {number} value - value as int
2077
+ */
2078
+ set bit32be(value) {
2079
+ this.bit(value, 32, undefined, "big");
2080
+ }
2081
+ /**
2082
+ * Bit field writer. Writes 32 bits.
2083
+ *
2084
+ * Note: When returning to a byte write, remaining bits are dropped.
2085
+ *
2086
+ * @param {number} value - value as int
2087
+ */
2088
+ set ubit32(value) {
2089
+ this.bit(value, 32, true);
2090
+ }
2091
+ /**
2092
+ * Bit field writer. Writes 32 bits.
2093
+ *
2094
+ * Note: When returning to a byte write, remaining bits are dropped.
2095
+ *
2096
+ * @param {number} value - value as int
2097
+ */
2098
+ set ubit32le(value) {
2099
+ this.bit(value, 32, true, "little");
2100
+ ;
2101
+ }
2102
+ /**
2103
+ * Bit field writer. Writes 32 bits.
2104
+ *
2105
+ * Note: When returning to a byte write, remaining bits are dropped.
2106
+ *
2107
+ * @param {number} value - value as int
2108
+ */
2109
+ set ubit32be(value) {
2110
+ this.bit(value, 32, true, "big");
2111
+ }
2112
+ //
2113
+ // byte write
2114
+ //
2115
+ /**
2116
+ * Write byte.
2117
+ *
2118
+ * @param {number} value - value as int
2119
+ */
2120
+ set byte(value) {
2121
+ this.writeByte(value);
2122
+ }
2123
+ /**
2124
+ * Write byte.
2125
+ *
2126
+ * @param {number} value - value as int
2127
+ */
2128
+ set int8(value) {
2129
+ this.writeByte(value);
2130
+ }
2131
+ /**
2132
+ * Write unsigned byte.
2133
+ *
2134
+ * @param {number} value - value as int
2135
+ */
2136
+ set uint8(value) {
2137
+ this.writeByte(value, true);
2138
+ }
2139
+ /**
2140
+ * Write unsigned byte.
2141
+ *
2142
+ * @param {number} value - value as int
2143
+ */
2144
+ set ubyte(value) {
2145
+ this.writeByte(value, true);
2146
+ }
2147
+ //
2148
+ // short writes
2149
+ //
2150
+ /**
2151
+ * Write int16.
2152
+ *
2153
+ * @param {number} value - value as int
2154
+ */
2155
+ set int16(value) {
2156
+ this.writeInt16(value);
2157
+ }
2158
+ /**
2159
+ * Write int16.
2160
+ *
2161
+ * @param {number} value - value as int
2162
+ */
2163
+ set short(value) {
2164
+ this.writeInt16(value);
2165
+ }
2166
+ /**
2167
+ * Write int16.
2168
+ *
2169
+ * @param {number} value - value as int
2170
+ */
2171
+ set word(value) {
2172
+ this.writeInt16(value);
2173
+ }
2174
+ /**
2175
+ * Write unsigned int16.
2176
+ *
2177
+ * @param {number} value - value as int
2178
+ */
2179
+ set uint16(value) {
2180
+ this.writeInt16(value, true);
2181
+ }
2182
+ /**
2183
+ * Write unsigned int16.
2184
+ *
2185
+ * @param {number} value - value as int
2186
+ */
2187
+ set ushort(value) {
2188
+ this.writeInt16(value, true);
2189
+ }
2190
+ /**
2191
+ * Write unsigned int16.
2192
+ *
2193
+ * @param {number} value - value as int
2194
+ */
2195
+ set uword(value) {
2196
+ this.writeInt16(value, true);
2197
+ }
2198
+ /**
2199
+ * Write signed int16.
2200
+ *
2201
+ * @param {number} value - value as int
2202
+ */
2203
+ set int16be(value) {
2204
+ this.writeInt16(value, false, "big");
2205
+ }
2206
+ /**
2207
+ * Write signed int16.
2208
+ *
2209
+ * @param {number} value - value as int
2210
+ */
2211
+ set shortbe(value) {
2212
+ this.writeInt16(value, false, "big");
2213
+ }
2214
+ /**
2215
+ * Write signed int16.
2216
+ *
2217
+ * @param {number} value - value as int
2218
+ */
2219
+ set wordbe(value) {
2220
+ this.writeInt16(value, false, "big");
2221
+ }
2222
+ /**
2223
+ * Write unsigned int16.
2224
+ *
2225
+ * @param {number} value - value as int
2226
+ */
2227
+ set uint16be(value) {
2228
+ this.writeInt16(value, true, "big");
2229
+ }
2230
+ /**
2231
+ * Write unsigned int16.
2232
+ *
2233
+ * @param {number} value - value as int
2234
+ */
2235
+ set ushortbe(value) {
2236
+ this.writeInt16(value, true, "big");
2237
+ }
2238
+ /**
2239
+ * Write unsigned int16.
2240
+ *
2241
+ * @param {number} value - value as int
2242
+ */
2243
+ set uwordbe(value) {
2244
+ this.writeInt16(value, true, "big");
2245
+ }
2246
+ /**
2247
+ * Write signed int16.
2248
+ *
2249
+ * @param {number} value - value as int
2250
+ */
2251
+ set int16le(value) {
2252
+ this.writeInt16(value, false, "little");
2253
+ }
2254
+ /**
2255
+ * Write signed int16.
2256
+ *
2257
+ * @param {number} value - value as int
2258
+ */
2259
+ set shortle(value) {
2260
+ this.writeInt16(value, false, "little");
2261
+ }
2262
+ /**
2263
+ * Write signed int16.
2264
+ *
2265
+ * @param {number} value - value as int
2266
+ */
2267
+ set wordle(value) {
2268
+ this.writeInt16(value, false, "little");
2269
+ }
2270
+ /**
2271
+ * Write unsigned int16.
2272
+ *
2273
+ * @param {number} value - value as int
2274
+ */
2275
+ set uint16le(value) {
2276
+ this.writeInt16(value, true, "little");
2277
+ }
2278
+ /**
2279
+ * Write unsigned int16.
2280
+ *
2281
+ * @param {number} value - value as int
2282
+ */
2283
+ set ushortle(value) {
2284
+ this.writeInt16(value, true, "little");
2285
+ }
2286
+ /**
2287
+ * Write unsigned int16.
2288
+ *
2289
+ * @param {number} value - value as int
2290
+ */
2291
+ set uwordle(value) {
2292
+ this.writeInt16(value, true, "little");
2293
+ }
2294
+ //
2295
+ // half float
2296
+ //
2297
+ /**
2298
+ * Writes half float.
2299
+ *
2300
+ * @param {number} value - value as int
2301
+ */
2302
+ set half(value) {
2303
+ this.writeHalfFloat(value);
2304
+ }
2305
+ /**
2306
+ * Writes half float.
2307
+ *
2308
+ * @param {number} value - value as int
2309
+ */
2310
+ set halffloat(value) {
2311
+ this.writeHalfFloat(value);
2312
+ }
2313
+ /**
2314
+ * Writes half float.
2315
+ *
2316
+ * @param {number} value - value as int
2317
+ */
2318
+ set halffloatbe(value) {
2319
+ this.writeHalfFloat(value, "big");
2320
+ }
2321
+ /**
2322
+ * Writes half float.
2323
+ *
2324
+ * @param {number} value - value as int
2325
+ */
2326
+ set halfbe(value) {
2327
+ this.writeHalfFloat(value, "big");
2328
+ }
2329
+ /**
2330
+ * Writes half float.
2331
+ *
2332
+ * @param {number} value - value as int
2333
+ */
2334
+ set halffloatle(value) {
2335
+ this.writeHalfFloat(value, "little");
2336
+ }
2337
+ /**
2338
+ * Writes half float.
2339
+ *
2340
+ * @param {number} value - value as int
2341
+ */
2342
+ set halfle(value) {
2343
+ this.writeHalfFloat(value, "little");
2344
+ }
2345
+ //
2346
+ // int32 write
2347
+ //
2348
+ /**
2349
+ * Write int32.
2350
+ *
2351
+ * @param {number} value - value as int
2352
+ */
2353
+ set int(value) {
2354
+ this.writeInt32(value);
2355
+ }
2356
+ /**
2357
+ * Write int32.
2358
+ *
2359
+ * @param {number} value - value as int
2360
+ */
2361
+ set int32(value) {
2362
+ this.writeInt32(value);
2363
+ }
2364
+ /**
2365
+ * Write int32.
2366
+ *
2367
+ * @param {number} value - value as int
2368
+ */
2369
+ set double(value) {
2370
+ this.writeInt32(value);
2371
+ }
2372
+ /**
2373
+ * Write int32.
2374
+ *
2375
+ * @param {number} value - value as int
2376
+ */
2377
+ set long(value) {
2378
+ this.writeInt32(value);
2379
+ }
2380
+ /**
2381
+ * Write unsigned int32.
2382
+ *
2383
+ * @param {number} value - value as int
2384
+ */
2385
+ set uint32(value) {
2386
+ this.writeInt32(value, true);
2387
+ }
2388
+ /**
2389
+ * Write unsigned int32.
2390
+ *
2391
+ * @param {number} value - value as int
2392
+ */
2393
+ set uint(value) {
2394
+ this.writeInt32(value, true);
2395
+ }
2396
+ /**
2397
+ * Write unsigned int32.
2398
+ *
2399
+ * @param {number} value - value as int
2400
+ */
2401
+ set udouble(value) {
2402
+ this.writeInt32(value, true);
2403
+ }
2404
+ /**
2405
+ * Write unsigned int32.
2406
+ *
2407
+ * @param {number} value - value as int
2408
+ */
2409
+ set ulong(value) {
2410
+ this.writeInt32(value, true);
2411
+ }
2412
+ /**
2413
+ * Write signed int32.
2414
+ *
2415
+ * @param {number} value - value as int
2416
+ */
2417
+ set int32le(value) {
2418
+ this.writeInt32(value, false, "little");
2419
+ }
2420
+ /**
2421
+ * Write signed int32.
2422
+ *
2423
+ * @param {number} value - value as int
2424
+ */
2425
+ set intle(value) {
2426
+ this.writeInt32(value, false, "little");
2427
+ }
2428
+ /**
2429
+ * Write signed int32.
2430
+ *
2431
+ * @param {number} value - value as int
2432
+ */
2433
+ set doublele(value) {
2434
+ this.writeInt32(value, false, "little");
2435
+ }
2436
+ /**
2437
+ * Write signed int32.
2438
+ *
2439
+ * @param {number} value - value as int
2440
+ */
2441
+ set longle(value) {
2442
+ this.writeInt32(value, false, "little");
2443
+ }
2444
+ /**
2445
+ * Write unsigned int32.
2446
+ *
2447
+ * @param {number} value - value as int
2448
+ */
2449
+ set uint32le(value) {
2450
+ this.writeInt32(value, true, "little");
2451
+ }
2452
+ /**
2453
+ * Write unsigned int32.
2454
+ *
2455
+ * @param {number} value - value as int
2456
+ */
2457
+ set uintle(value) {
2458
+ this.writeInt32(value, true, "little");
2459
+ }
2460
+ /**
2461
+ * Write unsigned int32.
2462
+ *
2463
+ * @param {number} value - value as int
2464
+ */
2465
+ set udoublele(value) {
2466
+ this.writeInt32(value, true, "little");
2467
+ }
2468
+ /**
2469
+ * Write unsigned int32.
2470
+ *
2471
+ * @param {number} value - value as int
2472
+ */
2473
+ set ulongle(value) {
2474
+ this.writeInt32(value, true, "little");
2475
+ }
2476
+ /**
2477
+ * Write signed int32.
2478
+ *
2479
+ * @param {number} value - value as int
2480
+ */
2481
+ set intbe(value) {
2482
+ this.writeInt32(value, false, "big");
2483
+ }
2484
+ /**
2485
+ * Write signed int32.
2486
+ *
2487
+ * @param {number} value - value as int
2488
+ */
2489
+ set int32be(value) {
2490
+ this.writeInt32(value, false, "big");
2491
+ }
2492
+ /**
2493
+ * Write signed int32.
2494
+ *
2495
+ * @param {number} value - value as int
2496
+ */
2497
+ set doublebe(value) {
2498
+ this.writeInt32(value, false, "big");
2499
+ }
2500
+ /**
2501
+ * Write signed int32.
2502
+ *
2503
+ * @param {number} value - value as int
2504
+ */
2505
+ set longbe(value) {
2506
+ this.writeInt32(value, false, "big");
2507
+ }
2508
+ /**
2509
+ * Write unsigned int32.
2510
+ *
2511
+ * @param {number} value - value as int
2512
+ */
2513
+ set writeUInt32BE(value) {
2514
+ this.writeInt32(value, true, "big");
2515
+ }
2516
+ /**
2517
+ * Write unsigned int32.
2518
+ *
2519
+ * @param {number} value - value as int
2520
+ */
2521
+ set uint32be(value) {
2522
+ this.writeInt32(value, true, "big");
2523
+ }
2524
+ /**
2525
+ * Write unsigned int32.
2526
+ *
2527
+ * @param {number} value - value as int
2528
+ */
2529
+ set uintbe(value) {
2530
+ this.writeInt32(value, true, "big");
2531
+ }
2532
+ /**
2533
+ * Write unsigned int32.
2534
+ *
2535
+ * @param {number} value - value as int
2536
+ */
2537
+ set udoublebe(value) {
2538
+ this.writeInt32(value, true, "big");
2539
+ }
2540
+ /**
2541
+ * Write unsigned int32.
2542
+ *
2543
+ * @param {number} value - value as int
2544
+ */
2545
+ set ulongbe(value) {
2546
+ this.writeInt32(value, true, "big");
2547
+ }
2548
+ //
2549
+ // float write
2550
+ //
2551
+ /**
2552
+ * Write float.
2553
+ *
2554
+ * @param {number} value - value as int
2555
+ */
2556
+ set float(value) {
2557
+ this.writeFloat(value);
2558
+ }
2559
+ /**
2560
+ * Write float.
2561
+ *
2562
+ * @param {number} value - value as int
2563
+ */
2564
+ set floatle(value) {
2565
+ this.writeFloat(value, "little");
2566
+ }
2567
+ /**
2568
+ * Write float.
2569
+ *
2570
+ * @param {number} value - value as int
2571
+ */
2572
+ set floatbe(value) {
2573
+ this.writeFloat(value, "big");
2574
+ }
2575
+ //
2576
+ // int64 write
2577
+ //
2578
+ /**
2579
+ * Write 64 bit integer.
2580
+ *
2581
+ * @param {number} value - value as int
2582
+ */
2583
+ set int64(value) {
2584
+ this.writeInt64(value);
2585
+ }
2586
+ /**
2587
+ * Write 64 bit integer.
2588
+ *
2589
+ * @param {number} value - value as int
2590
+ */
2591
+ set quad(value) {
2592
+ this.writeInt64(value);
2593
+ }
2594
+ /**
2595
+ * Write 64 bit integer.
2596
+ *
2597
+ * @param {number} value - value as int
2598
+ */
2599
+ set bigint(value) {
2600
+ this.writeInt64(value);
2601
+ }
2602
+ /**
2603
+ * Write unsigned 64 bit integer.
2604
+ *
2605
+ * @param {number} value - value as int
2606
+ */
2607
+ set uint64(value) {
2608
+ this.writeInt64(value, true);
2609
+ }
2610
+ /**
2611
+ * Write unsigned 64 bit integer.
2612
+ *
2613
+ * @param {number} value - value as int
2614
+ */
2615
+ set ubigint(value) {
2616
+ this.writeInt64(value, true);
2617
+ }
2618
+ /**
2619
+ * Write unsigned 64 bit integer.
2620
+ *
2621
+ * @param {number} value - value as int
2622
+ */
2623
+ set uquad(value) {
2624
+ this.writeInt64(value, true);
2625
+ }
2626
+ /**
2627
+ * Write signed 64 bit integer.
2628
+ *
2629
+ * @param {number} value - value as int
2630
+ */
2631
+ set int64le(value) {
2632
+ this.writeInt64(value, false, "little");
2633
+ }
2634
+ /**
2635
+ * Write signed 64 bit integer.
2636
+ *
2637
+ * @param {number} value - value as int
2638
+ */
2639
+ set bigintle(value) {
2640
+ this.writeInt64(value, false, "little");
2641
+ }
2642
+ /**
2643
+ * Write signed 64 bit integer.
2644
+ *
2645
+ * @param {number} value - value as int
2646
+ */
2647
+ set quadle(value) {
2648
+ this.writeInt64(value, false, "little");
2649
+ }
2650
+ /**
2651
+ * Write unsigned 64 bit integer.
2652
+ *
2653
+ * @param {number} value - value as int
2654
+ */
2655
+ set uint64le(value) {
2656
+ this.writeInt64(value, true, "little");
2657
+ }
2658
+ /**
2659
+ * Write unsigned 64 bit integer.
2660
+ *
2661
+ * @param {number} value - value as int
2662
+ */
2663
+ set ubigintle(value) {
2664
+ this.writeInt64(value, true, "little");
2665
+ }
2666
+ /**
2667
+ * Write unsigned 64 bit integer.
2668
+ *
2669
+ * @param {number} value - value as int
2670
+ */
2671
+ set uquadle(value) {
2672
+ this.writeInt64(value, true, "little");
2673
+ }
2674
+ /**
2675
+ * Write signed 64 bit integer.
2676
+ *
2677
+ * @param {number} value - value as int
2678
+ */
2679
+ set int64be(value) {
2680
+ this.writeInt64(value, false, "big");
2681
+ }
2682
+ /**
2683
+ * Write signed 64 bit integer.
2684
+ *
2685
+ * @param {number} value - value as int
2686
+ */
2687
+ set bigintbe(value) {
2688
+ this.writeInt64(value, false, "big");
2689
+ }
2690
+ /**
2691
+ * Write signed 64 bit integer.
2692
+ *
2693
+ * @param {number} value - value as int
2694
+ */
2695
+ set quadbe(value) {
2696
+ this.writeInt64(value, false, "big");
2697
+ }
2698
+ /**
2699
+ * Write unsigned 64 bit integer.
2700
+ *
2701
+ * @param {number} value - value as int
2702
+ */
2703
+ set uint64be(value) {
2704
+ this.writeInt64(value, true, "big");
2705
+ }
2706
+ /**
2707
+ * Write unsigned 64 bit integer.
2708
+ *
2709
+ * @param {number} value - value as int
2710
+ */
2711
+ set ubigintbe(value) {
2712
+ this.writeInt64(value, true, "big");
2713
+ }
2714
+ /**
2715
+ * Write unsigned 64 bit integer.
2716
+ *
2717
+ * @param {number} value - value as int
2718
+ */
2719
+ set uquadbe(value) {
2720
+ this.writeInt64(value, true, "big");
2721
+ }
2722
+ //
2723
+ // doublefloat
2724
+ //
2725
+ /**
2726
+ * Writes double float.
2727
+ *
2728
+ * @param {number} value - value as int
2729
+ */
2730
+ set doublefloat(value) {
2731
+ this.writeDoubleFloat(value);
2732
+ }
2733
+ /**
2734
+ * Writes double float.
2735
+ *
2736
+ * @param {number} value - value as int
2737
+ */
2738
+ set dfloat(value) {
2739
+ this.writeDoubleFloat(value);
2740
+ }
2741
+ /**
2742
+ * Writes double float.
2743
+ *
2744
+ * @param {number} value - value as int
2745
+ */
2746
+ set dfloatbe(value) {
2747
+ this.writeDoubleFloat(value, "big");
2748
+ }
2749
+ /**
2750
+ * Writes double float.
2751
+ *
2752
+ * @param {number} value - value as int
2753
+ */
2754
+ set doublefloatbe(value) {
2755
+ this.writeDoubleFloat(value, "big");
2756
+ }
2757
+ /**
2758
+ * Writes double float.
2759
+ *
2760
+ * @param {number} value - value as int
2761
+ */
2762
+ set dfloatle(value) {
2763
+ this.writeDoubleFloat(value, "little");
2764
+ }
2765
+ /**
2766
+ * Writes double float.
2767
+ *
2768
+ * @param {number} value - value as int
2769
+ */
2770
+ set doublefloatle(value) {
2771
+ this.writeDoubleFloat(value, "little");
2772
+ }
2773
+ //
2774
+ // string
2775
+ //
2776
+ /**
2777
+ * Writes string, use options object for different types.
2778
+ *
2779
+ *
2780
+ * @param {string} string - text string
2781
+ * @param {object} options - options:
2782
+ * ```javascript
2783
+ * {
2784
+ * length: string.length, //for fixed length, non-terminate value utf strings
2785
+ * stringType: "utf-8", //utf-8, utf-16, pascal or wide-pascal
2786
+ * terminateValue: 0x00, // only with stringType: "utf"
2787
+ * lengthWriteSize: 1, //for pascal strings. 1, 2 or 4 byte length write size
2788
+ * encoding: "utf-8", //TextEncoder accepted types
2789
+ * endian: "little", //for wide-pascal and utf-16
2790
+ * }
2791
+ * ```
2792
+ */
2793
+ string(string, options) {
2794
+ return this.writeString(string, options);
2795
+ }
2796
+ /**
2797
+ * Writes UTF-8 (C) string.
2798
+ *
2799
+ * @param {string} string - text string
2800
+ * @param {number} length - for fixed length utf strings
2801
+ * @param {number} terminateValue - for non-fixed length utf strings
2802
+ *
2803
+ * @return string
2804
+ */
2805
+ utf8string(string, length, terminateValue) {
2806
+ return this.string(string, { stringType: "utf-8", encoding: "utf-8", length: length, terminateValue: terminateValue });
2807
+ }
2808
+ /**
2809
+ * Writes UTF-8 (C) string.
2810
+ *
2811
+ * @param {string} string - text string
2812
+ * @param {number} length - for fixed length utf strings
2813
+ * @param {number} terminateValue - for non-fixed length utf strings
2814
+ *
2815
+ * @return string
2816
+ */
2817
+ cstring(string, length, terminateValue) {
2818
+ return this.string(string, { stringType: "utf-8", encoding: "utf-8", length: length, terminateValue: terminateValue });
2819
+ }
2820
+ /**
2821
+ * Writes ANSI string.
2822
+ *
2823
+ * @param {string} string - text string
2824
+ * @param {number} length - for fixed length utf strings
2825
+ * @param {number} terminateValue - for non-fixed length utf strings
2826
+ */
2827
+ ansistring(string, length, terminateValue) {
2828
+ return this.string(string, { stringType: "utf-8", encoding: "windows-1252", length: length, terminateValue: terminateValue });
2829
+ }
2830
+ /**
2831
+ * Writes UTF-16 (Unicode) string.
2832
+ *
2833
+ * @param {string} string - text string
2834
+ * @param {number} length - for fixed length utf strings
2835
+ * @param {number} terminateValue - for non-fixed length utf strings
2836
+ * @param {string} endian - ``big`` or ``little``
2837
+ */
2838
+ utf16string(string, length, terminateValue, endian) {
2839
+ return this.string(string, { stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: endian });
2840
+ }
2841
+ /**
2842
+ * Writes UTF-16 (Unicode) string.
2843
+ *
2844
+ * @param {string} string - text string
2845
+ * @param {number} length - for fixed length utf strings
2846
+ * @param {number} terminateValue - for non-fixed length utf strings
2847
+ * @param {string} endian - ``big`` or ``little``
2848
+ */
2849
+ unistring(string, length, terminateValue, endian) {
2850
+ return this.string(string, { stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: endian });
2851
+ }
2852
+ /**
2853
+ * Writes UTF-16 (Unicode) string in little endian order.
2854
+ *
2855
+ * @param {string} string - text string
2856
+ * @param {number} length - for fixed length utf strings
2857
+ * @param {number} terminateValue - for non-fixed length utf strings
2858
+ */
2859
+ utf16stringle(string, length, terminateValue) {
2860
+ return this.string(string, { stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "little" });
2861
+ }
2862
+ /**
2863
+ * Writes UTF-16 (Unicode) string in little endian order.
2864
+ *
2865
+ * @param {string} string - text string
2866
+ * @param {number} length - for fixed length utf strings
2867
+ * @param {number} terminateValue - for non-fixed length utf strings
2868
+ */
2869
+ unistringle(string, length, terminateValue) {
2870
+ return this.string(string, { stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "little" });
2871
+ }
2872
+ /**
2873
+ * Writes UTF-16 (Unicode) string in big endian order.
2874
+ *
2875
+ * @param {string} string - text string
2876
+ * @param {number} length - for fixed length utf strings
2877
+ * @param {number} terminateValue - for non-fixed length utf strings
2878
+ */
2879
+ utf16stringbe(string, length, terminateValue) {
2880
+ return this.string(string, { stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "big" });
2881
+ }
2882
+ /**
2883
+ * Writes UTF-16 (Unicode) string in big endian order.
2884
+ *
2885
+ * @param {string} string - text string
2886
+ * @param {number} length - for fixed length utf strings
2887
+ * @param {number} terminateValue - for non-fixed length utf strings
2888
+ */
2889
+ unistringbe(string, length, terminateValue) {
2890
+ return this.string(string, { stringType: "utf-16", encoding: "utf-16", length: length, terminateValue: terminateValue, endian: "big" });
2891
+ }
2892
+ /**
2893
+ * Writes Pascal string.
2894
+ *
2895
+ * @param {string} string - text string
2896
+ * @param {number} lengthWriteSize - 1, 2 or 4 byte length write size (default 1)
2897
+ * @param {string} endian - ``big`` or ``little`` for 2 or 4 byte length write size
2898
+ */
2899
+ pstring(string, lengthWriteSize, endian) {
2900
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: lengthWriteSize, endian: endian });
2901
+ }
2902
+ /**
2903
+ * Writes Pascal string 1 byte length read.
2904
+ *
2905
+ * @param {string} string - text string
2906
+ * @param {string} endian - ``big`` or ``little`` for 2 or 4 byte length write size
2907
+ */
2908
+ pstring1(string, endian) {
2909
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 1, endian: endian });
2910
+ }
2911
+ /**
2912
+ * Writes Pascal string 1 byte length read in little endian order.
2913
+ *
2914
+ * @param {string} string - text string
2915
+ */
2916
+ pstring1le(string) {
2917
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 1, endian: "little" });
2918
+ }
2919
+ /**
2920
+ * Writes Pascal string 1 byte length read in big endian order.
2921
+ *
2922
+ * @param {string} string - text string
2923
+ */
2924
+ pstring1be(string) {
2925
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 1, endian: "big" });
2926
+ }
2927
+ /**
2928
+ * Writes Pascal string 2 byte length read.
2929
+ *
2930
+ * @param {string} string - text string
2931
+ * @param {string} endian - ``big`` or ``little``
2932
+ */
2933
+ pstring2(string, endian) {
2934
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 2, endian: endian });
2935
+ }
2936
+ /**
2937
+ * Writes Pascal string 2 byte length read in little endian order.
2938
+ *
2939
+ * @param {string} string - text string
2940
+ */
2941
+ pstring2le(string) {
2942
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 2, endian: "little" });
2943
+ }
2944
+ /**
2945
+ * Writes Pascal string 2 byte length read in big endian order.
2946
+ *
2947
+ * @param {string} string - text string
2948
+ */
2949
+ pstring2be(string) {
2950
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 2, endian: "big" });
2951
+ }
2952
+ /**
2953
+ * Writes Pascal string 4 byte length read.
2954
+ *
2955
+ * @param {string} string - text string
2956
+ * @param {string} endian - ``big`` or ``little``
2957
+ */
2958
+ pstring4(string, endian) {
2959
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 4, endian: endian });
2960
+ }
2961
+ /**
2962
+ * Writes Pascal string 4 byte length read in big endian order.
2963
+ *
2964
+ * @param {string} string - text string
2965
+ */
2966
+ pstring4be(string) {
2967
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 4, endian: "big" });
2968
+ }
2969
+ /**
2970
+ * Writes Pascal string 4 byte length read in little endian order.
2971
+ *
2972
+ * @param {string} string - text string
2973
+ */
2974
+ pstring4le(string) {
2975
+ return this.string(string, { stringType: "pascal", encoding: "utf-8", lengthWriteSize: 4, endian: "little" });
2976
+ }
2977
+ /**
2978
+ * Writes Wide-Pascal string.
2979
+ *
2980
+ * @param {string} string - text string
2981
+ * @param {number} lengthWriteSize - 1, 2 or 4 byte length write size (default 1)
2982
+ * @param {string} endian - ``big`` or ``little``
2983
+ */
2984
+ wpstring(string, lengthWriteSize, endian) {
2985
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: lengthWriteSize, endian: endian });
2986
+ }
2987
+ /**
2988
+ * Writes Wide-Pascal string in big endian order.
2989
+ *
2990
+ * @param {string} string - text string
2991
+ * @param {number} lengthWriteSize - 1, 2 or 4 byte length write size (default 1)
2992
+ */
2993
+ wpstringbe(string, lengthWriteSize) {
2994
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: lengthWriteSize, endian: "big" });
2995
+ }
2996
+ /**
2997
+ * Writes Wide-Pascal string in little endian order.
2998
+ *
2999
+ * @param {string} string - text string
3000
+ * @param {number} lengthWriteSize - 1, 2 or 4 byte length write size (default 1)
3001
+ */
3002
+ wpstringle(string, lengthWriteSize) {
3003
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: lengthWriteSize, endian: "little" });
3004
+ }
3005
+ /**
3006
+ * Writes Wide-Pascal string.
3007
+ *
3008
+ * @param {string} string - text string
3009
+ * @param {string} endian - ``big`` or ``little``
3010
+ */
3011
+ wpstring1(string, endian) {
3012
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 1, endian: endian });
3013
+ }
3014
+ /**
3015
+ * Writes Wide-Pascal string 1 byte length read in big endian order.
3016
+ *
3017
+ * @param {string} string - text string
3018
+ */
3019
+ wpstring1be(string) {
3020
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 1, endian: "big" });
3021
+ }
3022
+ /**
3023
+ * Writes Wide-Pascal string 1 byte length read in little endian order.
3024
+ *
3025
+ * @param {string} string - text string
3026
+ */
3027
+ wpstring1le(string) {
3028
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 1, endian: "little" });
3029
+ }
3030
+ /**
3031
+ * Writes Wide-Pascal string 2 byte length read.
3032
+ *
3033
+ * @param {string} string - text string
3034
+ * @param {string} endian - ``big`` or ``little``
3035
+ */
3036
+ wpstring2(string, endian) {
3037
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 2, endian: endian });
3038
+ }
3039
+ /**
3040
+ * Writes Wide-Pascal string 2 byte length read in little endian order.
3041
+ *
3042
+ * @param {string} string - text string
3043
+ */
3044
+ wpstring2le(string) {
3045
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 2, endian: "little" });
3046
+ }
3047
+ /**
3048
+ * Writes Wide-Pascal string 2 byte length read in big endian order.
3049
+ *
3050
+ * @param {string} string - text string
3051
+ */
3052
+ wpstring2be(string) {
3053
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 2, endian: "big" });
3054
+ }
3055
+ /**
3056
+ * Writes Wide-Pascal string 4 byte length read.
3057
+ *
3058
+ * @param {string} string - text string
3059
+ * @param {string} endian - ``big`` or ``little``
3060
+ */
3061
+ wpstring4(string, endian) {
3062
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 4, endian: endian });
3063
+ }
3064
+ /**
3065
+ * Writes Wide-Pascal string 4 byte length read in little endian order.
3066
+ *
3067
+ * @param {string} string - text string
3068
+ */
3069
+ wpstring4le(string) {
3070
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 4, endian: "little" });
3071
+ }
3072
+ /**
3073
+ * Writes Wide-Pascal string 4 byte length read in big endian order.
3074
+ *
3075
+ * @param {string} string - text string
3076
+ */
3077
+ wpstring4be(string) {
3078
+ return this.string(string, { stringType: "wide-pascal", encoding: "utf-16", lengthWriteSize: 4, endian: "big" });
3079
+ }
3080
+ }
3081
+ exports.BiWriter = BiWriter;
3082
+ //# sourceMappingURL=biwriter.js.map