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