bireader 1.0.25 → 1.0.27

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