bireader 1.0.13 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.biwriter = void 0;
4
+ const common_1 = require("./common");
4
5
  /**
5
6
  * Binary writer, includes bitfields and strings
6
7
  *
7
8
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
8
- * @param {number} byteOffset - byte offset to start writer, default is 0
9
- * @param {number} bitOffset - bit offset to start writer, 0-7
10
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
11
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
9
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
10
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
11
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
12
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
12
13
  */
13
14
  class biwriter {
14
15
  isBuffer(obj) {
@@ -21,43 +22,25 @@ class biwriter {
21
22
  if ((typeof Buffer !== 'undefined' && this.data instanceof Buffer)) {
22
23
  var paddbuffer = Buffer.alloc(to_padd);
23
24
  this.data = Buffer.concat([this.data, paddbuffer]);
25
+ this.size = this.data.length;
24
26
  }
25
27
  else {
26
28
  const addArray = new Array(to_padd);
27
29
  this.data = new Uint8Array([...this.data, ...addArray]);
30
+ this.size = this.data.length;
28
31
  }
29
32
  }
30
33
  check_size(write_bytes, write_bit, offset) {
31
- const bits = (write_bit || 0) + this.bitoffset;
32
- var new_off = (offset || this.offset);
33
- var writesize = write_bytes || 0;
34
- if (bits != 0) {
35
- //add bits
36
- writesize += Math.ceil(bits / 8);
37
- }
38
- //if biger extend
39
- const needed_size = new_off + writesize;
40
- if (needed_size > this.size) {
41
- const dif = needed_size - this.size;
42
- if (this.strict == false) {
43
- this.extendArray(dif);
44
- }
45
- else {
46
- throw new Error("Location outside of size of data: " + this.size);
47
- }
48
- this.size = this.data.length;
49
- }
50
- //start read location
51
- this.offset = new_off;
34
+ return (0, common_1.checkSize)(this, write_bytes || 0, write_bit || 0, offset || this.offset);
52
35
  }
53
36
  /**
54
37
  * Binary writer, includes bitfields and strings
55
38
  *
56
39
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
57
- * @param {number} byteOffset - byte offset to start writer, default is 0
58
- * @param {number} bitOffset - bit offset to start writer, 0-7
59
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
60
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
40
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
41
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
42
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
43
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
61
44
  */
62
45
  constructor(data, byteOffset, bitOffset, endianness, strict) {
63
46
  this.endian = "little";
@@ -65,6 +48,7 @@ class biwriter {
65
48
  this.bitoffset = 0;
66
49
  this.size = 0;
67
50
  this.strict = false;
51
+ this.errorDump = true;
68
52
  this.data = [];
69
53
  if (endianness != undefined && typeof endianness != "string") {
70
54
  throw new Error("endianness must be big or little");
@@ -96,7 +80,7 @@ class biwriter {
96
80
  throw new Error("Data required");
97
81
  }
98
82
  else {
99
- if (!this.isBufferOrUint8Array(this.data)) {
83
+ if (!this.isBufferOrUint8Array(data)) {
100
84
  throw new Error("Write data must be Uint8Array or Buffer");
101
85
  }
102
86
  }
@@ -104,8 +88,7 @@ class biwriter {
104
88
  this.size = this.data.length + ((bitOffset || 0) % 8);
105
89
  }
106
90
  /**
107
- *
108
- * Change endian, defaults to little
91
+ * Change endian (default little)
109
92
  *
110
93
  * Can be changed at any time, doesn't loose position
111
94
  *
@@ -121,169 +104,133 @@ class biwriter {
121
104
  this.endian = endian;
122
105
  }
123
106
  /**
124
- *
125
107
  * Sets endian to big
108
+ *
126
109
  */
127
110
  bigEndian() {
128
111
  this.endianness("big");
129
112
  }
130
113
  /**
131
- *
132
114
  * Sets endian to big
115
+ *
133
116
  */
134
117
  big() {
135
118
  this.endianness("big");
136
119
  }
137
120
  /**
138
- *
139
121
  * Sets endian to big
122
+ *
140
123
  */
141
124
  be() {
142
125
  this.endianness("big");
143
126
  }
144
127
  /**
145
- *
146
128
  * Sets endian to little
129
+ *
147
130
  */
148
131
  littleEndian() {
149
132
  this.endianness("little");
150
133
  }
151
134
  /**
152
- *
153
135
  * Sets endian to little
136
+ *
154
137
  */
155
138
  little() {
156
139
  this.endianness("little");
157
140
  }
158
141
  /**
159
- *
160
142
  * Sets endian to little
143
+ *
161
144
  */
162
145
  le() {
163
146
  this.endianness("little");
164
147
  }
148
+ //
149
+ // move from current position
150
+ //
165
151
  /**
166
- * Move current write byte or bit position, will extend data if outside of current size
152
+ * Offset current byte or bit position
153
+ * Note: Will extend array if strict mode is off and outside of max size
167
154
  *
168
- * @param {number} bytes - bytes to skip
169
- * @param {number} bits - bits to skip (0-7)
155
+ * @param {number} bytes - Bytes to skip
156
+ * @param {number} bits - Bits to skip (0-7)
170
157
  */
171
158
  skip(bytes, bits) {
172
- this.check_size(bytes, bits);
173
- this.offset += (bytes || 0);
174
- this.bitoffset += (bits || 0) % 8;
159
+ return (0, common_1.skip)(this, bytes, bits);
175
160
  }
176
161
  /**
177
- * Move current write byte or bit position, will extend data if outside of current size
162
+ * Offset current byte or bit position
163
+ * Note: Will extend array if strict mode is off and outside of max size
178
164
  *
179
- * @param {number} bytes - bytes to skip
180
- * @param {number} bits - bits to skip (0-7)
165
+ * @param {number} bytes - Bytes to skip
166
+ * @param {number} bits - Bits to skip (0-7)
181
167
  */
182
- fskip(bytes, bits) {
183
- this.check_size(bytes, bits);
184
- this.offset += (bytes || 0);
185
- this.bitoffset += (bits || 0) % 8;
168
+ jump(bytes, bits) {
169
+ this.skip(bytes, bits);
186
170
  }
171
+ //
172
+ // directly set current position
173
+ //
187
174
  /**
188
- * Change current byte or bit write position, will extend data if outside of current size
175
+ * Change position directly to address
176
+ * Note: Will extend array if strict mode is off and outside of max size
189
177
  *
190
- * @param {number} byte - byte to jump to
191
- * @param {number} bit - bit to jump to (0-7)
178
+ * @param {number} byte - byte to set to
179
+ * @param {number} bit - bit to set to (0-7)
192
180
  */
193
181
  goto(byte, bit) {
194
- const new_size = (byte + Math.ceil((bit || 0) / 8));
195
- if (new_size > this.size && this.strict == false) {
196
- this.extendArray(new_size - this.size);
197
- }
198
- else {
199
- throw new Error("Outside of range of data: " + this.size);
200
- }
201
- this.offset = byte;
202
- this.bitoffset = (bit || 0) % 8;
182
+ return (0, common_1.goto)(this, byte, bit);
203
183
  }
204
184
  /**
205
- * Change current byte or bit write position, will extend data if outside of current size
185
+ * Change position directly to address
186
+ * Note: Will extend array if strict mode is off and outside of max size
206
187
  *
207
- * @param {number} byte - byte to jump to
208
- * @param {number} bit - bit to jump to (0-7)
188
+ * @param {number} byte - byte to set to
189
+ * @param {number} bit - bit to set to (0-7)
209
190
  */
210
191
  seek(byte, bit) {
211
192
  return this.goto(byte, bit);
212
193
  }
213
194
  /**
214
- * Change current byte or bit write position, will extend data if outside of current size
215
- *
216
- * @param {number} byte - byte to jump to
217
- * @param {number} bit - bit to jump to (0-7)
218
- */
219
- fseek(byte, bit) {
220
- return this.goto(byte, bit);
221
- }
222
- /**
223
- * Change current byte or bit write position, will extend data if outside of current size
195
+ * Change position directly to address
196
+ * Note: Will extend array if strict mode is off and outside of max size
224
197
  *
225
- * @param {number} byte - byte to jump to
226
- * @param {number} bit - bit to jump to (0-7)
227
- */
228
- jump(byte, bit) {
229
- return this.goto(byte, bit);
230
- }
231
- /**
232
- * Change current byte or bit write position, will extend data if outside of current size
233
- *
234
- * @param {number} byte - byte to jump to
235
- * @param {number} bit - bit to jump to (0-7)
198
+ * @param {number} byte - byte to set to
199
+ * @param {number} bit - bit to set to (0-7)
236
200
  */
237
201
  pointer(byte, bit) {
238
202
  return this.goto(byte, bit);
239
203
  }
240
204
  /**
241
- * Change current byte or bit write position, will extend data if outside of current size
205
+ * Change position directly to address
206
+ * Note: Will extend array if strict mode is off and outside of max size
242
207
  *
243
- * @param {number} byte - byte to jump to
244
- * @param {number} bit - bit to jump to (0-7)
208
+ * @param {number} byte - byte to set to
209
+ * @param {number} bit - bit to set to (0-7)
245
210
  */
246
211
  warp(byte, bit) {
247
212
  return this.goto(byte, bit);
248
213
  }
214
+ //
215
+ //go to start
216
+ //
249
217
  /**
250
- * Change current byte or bit write position, will extend data if outside of current size
251
- *
252
- * @param {number} byte - byte to jump to
253
- * @param {number} bit - bit to jump to (0-7)
254
- */
255
- fsetpos(byte, bit) {
256
- return this.goto(byte, bit);
257
- }
258
- /**
259
- * Set offset to start of file
218
+ * Set byte and bit position to start of data
260
219
  */
261
220
  rewind() {
262
221
  this.offset = 0;
263
222
  this.bitoffset = 0;
264
223
  }
265
224
  /**
266
- * Set offset to start of file
225
+ * Set byte and bit position to start of data
267
226
  */
268
227
  gotostart() {
269
228
  this.offset = 0;
270
229
  this.bitoffset = 0;
271
230
  }
272
- /**
273
- * Set offset to start of file
274
- */
275
- tostart() {
276
- this.offset = 0;
277
- this.bitoffset = 0;
278
- }
279
- /**
280
- * Get the current byte position
281
- *
282
- * @return {number} current byte position
283
- */
284
- ftell() {
285
- return this.offset;
286
- }
231
+ //
232
+ //get position
233
+ //
287
234
  /**
288
235
  * Get the current byte position
289
236
  *
@@ -297,7 +244,7 @@ class biwriter {
297
244
  *
298
245
  * @return {number} current byte position
299
246
  */
300
- fgetpos() {
247
+ getOffset() {
301
248
  return this.offset;
302
249
  }
303
250
  /**
@@ -308,131 +255,201 @@ class biwriter {
308
255
  saveOffset() {
309
256
  return this.offset;
310
257
  }
258
+ //
259
+ //strict mode change
260
+ //
311
261
  /**
312
- * Disallows extending array if writing outside of max size
262
+ * Disallows extending data if position is outside of max size
313
263
  */
314
264
  restrict() {
315
265
  this.strict = true;
316
266
  }
317
267
  /**
318
- * Allows extending array if writing outside of max size
268
+ * Allows extending data if position is outside of max size
319
269
  */
320
270
  unrestrict() {
321
271
  this.strict = false;
322
272
  }
273
+ //
274
+ //remove part of data
275
+ //
323
276
  /**
324
- * Truncates array from start to current position unless supplied
325
- * Note: Does not affect supplied data
326
- * Note: Will extend array if strict mode is off
327
- * @param {number} startOffset - Start location, default 0
328
- * @param {number} endOffset - end location, default current write position
329
- */
330
- clip(startOffset, endOffset) {
331
- if ((endOffset || this.offset) > this.size) {
332
- if (this.strict == false) {
333
- this.extendArray((endOffset || this.offset) - this.size);
334
- }
335
- else {
336
- throw new Error("End offset outside of data: " + this.size);
337
- }
338
- }
339
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
277
+ * Deletes part of data from start to current byte position unless supplied, returns removed
278
+ * Note: Errors in strict mode
279
+ *
280
+ * @param {number} startOffset - Start location (default 0)
281
+ * @param {number} endOffset - End location (default current position)
282
+ * @param {boolean} consume - Move position to end of removed data (default false)
283
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
284
+ */
285
+ delete(startOffset, endOffset, consume) {
286
+ return (0, common_1.remove)(this, startOffset || 0, endOffset || this.offset, consume || false, true);
340
287
  }
341
288
  /**
342
- * Truncates array from start to current position unless supplied
343
- * Note: Does not affect supplied data
344
- * Note: Will extend array if strict mode is off
345
- * @param {number} startOffset - Start location, default 0
346
- * @param {number} endOffset - end location, default current write position
347
- */
348
- crop(startOffset, endOffset) {
349
- if ((endOffset || this.offset) > this.size) {
350
- if (this.strict == false) {
351
- this.extendArray((endOffset || this.offset) - this.size);
352
- }
353
- else {
354
- throw new Error("End offset outside of data: " + this.size);
355
- }
356
- }
357
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
289
+ * Deletes part of data from start to current byte position unless supplied, returns removed
290
+ * Note: Errors in strict mode
291
+ *
292
+ * @param {number} startOffset - Start location (default 0)
293
+ * @param {number} endOffset - End location (default current position)
294
+ * @param {boolean} consume - Move position to end of removed data (default false)
295
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
296
+ */
297
+ clip(startOffset, endOffset, consume) {
298
+ return (0, common_1.remove)(this, startOffset || 0, endOffset || this.offset, consume || false, true);
358
299
  }
359
300
  /**
360
- * Truncates array from start to current position unless supplied
361
- * Note: Does not affect supplied data
362
- * Note: Will extend array if strict mode is off
363
- * @param {number} startOffset - Start location, default 0
364
- * @param {number} endOffset - end location, default current write position
365
- */
366
- truncate(startOffset, endOffset) {
367
- if ((endOffset || this.offset) > this.size) {
368
- if (this.strict == false) {
369
- this.extendArray((endOffset || this.offset) - this.size);
370
- }
371
- else {
372
- throw new Error("End offset outside of data: " + this.size);
373
- }
374
- }
375
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
301
+ * Deletes part of data from current byte position to supplied length, returns removed
302
+ * Note: Errors in strict mode
303
+ *
304
+ * @param {number} length - Length of data in bytes to remove
305
+ * @param {boolean} consume - Move position to end of removed data (default false)
306
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
307
+ */
308
+ crop(length, consume) {
309
+ return (0, common_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, true);
376
310
  }
377
311
  /**
378
- * Truncates array from start to current position unless supplied
379
- * Note: Does not affect supplied data
380
- * Note: Will extend array if strict mode is off
381
- * @param {number} startOffset - Start location, default 0
382
- * @param {number} endOffset - end location, default current write position
383
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
312
+ * Deletes part of data from current position to supplied length, returns removed
313
+ * Note: Only works in strict mode
314
+ *
315
+ * @param {number} length - Length of data in bytes to remove
316
+ * @param {boolean} consume - Move position to end of removed data (default false)
317
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
384
318
  */
385
- slice(startOffset, endOffset) {
386
- if ((endOffset || this.offset) > this.size) {
387
- if (this.strict == false) {
388
- this.extendArray((endOffset || this.offset) - this.size);
389
- }
390
- else {
391
- throw new Error("End offset outside of data: " + this.size);
392
- }
393
- }
394
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
319
+ drop(length, consume) {
320
+ return (0, common_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, true);
395
321
  }
322
+ //
323
+ //copy out
324
+ //
396
325
  /**
397
- * Extract array from current position to length supplied
326
+ * Returns part of data from current byte position to end of data unless supplied
327
+ *
328
+ * @param {number} startOffset - Start location (default current position)
329
+ * @param {number} endOffset - End location (default end of data)
330
+ * @param {boolean} consume - Move position to end of lifted data (default false)
331
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
332
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
333
+ */
334
+ lift(startOffset, endOffset, consume, fillValue) {
335
+ return (0, common_1.remove)(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
336
+ }
337
+ /**
338
+ * Returns part of data from current byte position to end of data unless supplied
339
+ *
340
+ * @param {number} startOffset - Start location (default current position)
341
+ * @param {number} endOffset - End location (default end of data)
342
+ * @param {boolean} consume - Move position to end of lifted data (default false)
343
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
344
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
345
+ */
346
+ fill(startOffset, endOffset, consume, fillValue) {
347
+ return (0, common_1.remove)(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
348
+ }
349
+ /**
350
+ * Extract data from current position to length supplied
398
351
  * Note: Does not affect supplied data
399
- * Note: Will extend array if strict mode is off
400
- * @param {number} length - length of data to copy from current offset
401
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
352
+ *
353
+ * @param {number} length - Length of data in bytes to copy from current offset
354
+ * @param {number} consume - Moves offset to end of length
355
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
402
356
  */
403
- extract(length) {
404
- if (this.offset + (length || 0) > this.size) {
405
- if (this.strict == false) {
406
- this.extendArray(this.offset + (length || 0) - this.size);
407
- }
408
- else {
409
- throw new Error("End offset outside of data: " + this.size);
410
- }
411
- }
412
- return this.data.slice(this.offset, this.offset + (length || 0));
357
+ extract(length, consume) {
358
+ return (0, common_1.remove)(this, this.offset, length || 0, consume || false, false);
413
359
  }
414
360
  /**
415
- * Extract array from current position to length supplied
361
+ * Extract data from current position to length supplied
416
362
  * Note: Does not affect supplied data
417
- * Note: Will extend array if strict mode is off
418
- * @param {number} length - length of data to copy from current offset
419
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
363
+ *
364
+ * @param {number} length - Length of data in bytes to copy from current offset
365
+ * @param {number} consume - Moves offset to end of length
366
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
420
367
  */
421
- wrap(length) {
422
- return this.extract(length);
368
+ slice(length, consume) {
369
+ return (0, common_1.remove)(this, this.offset, length || 0, consume || false, false);
423
370
  }
424
371
  /**
425
- * Extract array from current position to length supplied
372
+ * Extract data from current position to length supplied
426
373
  * Note: Does not affect supplied data
427
- * Note: Will extend array if strict mode is off
428
- * @param {number} length - length of data to copy from current offset
429
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
374
+ *
375
+ * @param {number} length - Length of data in bytes to copy from current offset
376
+ * @param {number} consume - Moves offset to end of length
377
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
378
+ */
379
+ wrap(length, consume) {
380
+ return (0, common_1.remove)(this, this.offset, length || 0, consume || false, false);
381
+ }
382
+ //
383
+ //insert
384
+ //
385
+ /**
386
+ * Inserts data into data
387
+ * Note: Must be same data type as supplied data. Errors on strict mode.
388
+ *
389
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
390
+ * @param {boolean} consume - Move current write position to end of data (default false)
391
+ * @param {number} offset - Offset to add it at (defaults to current position)
392
+ */
393
+ insert(data, consume, offset) {
394
+ return (0, common_1.addData)(this, data, consume || false, offset || this.offset);
395
+ }
396
+ /**
397
+ * Inserts data into data
398
+ * Note: Must be same data type as supplied data. Errors on strict mode.
399
+ *
400
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
401
+ * @param {boolean} consume - Move current write position to end of data (default false)
402
+ * @param {number} offset - Offset to add it at (defaults to current position)
403
+ */
404
+ place(data, consume, offset) {
405
+ return (0, common_1.addData)(this, data, consume || false, offset || this.offset);
406
+ }
407
+ /**
408
+ * Adds data to start of supplied data
409
+ * Note: Must be same data type as supplied data. Errors on strict mode.
410
+ *
411
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
412
+ * @param {boolean} consume - Move current write position to end of data (default false)
413
+ */
414
+ unshift(data, consume) {
415
+ return (0, common_1.addData)(this, data, consume || false, 0);
416
+ }
417
+ /**
418
+ * Adds data to start of supplied data
419
+ * Note: Must be same data type as supplied data. Errors on strict mode.
420
+ *
421
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
422
+ * @param {boolean} consume - Move current write position to end of data (default false)
423
+ */
424
+ prepend(data, consume) {
425
+ return (0, common_1.addData)(this, data, consume || false, 0);
426
+ }
427
+ /**
428
+ * Adds data to end of supplied data
429
+ * Note: Must be same data type as supplied data. Errors on strict mode.
430
+ *
431
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
432
+ * @param {boolean} consume - Move current write position to end of data (default false)
430
433
  */
431
- lift(length) {
432
- return this.extract(length);
434
+ push(data, consume) {
435
+ return (0, common_1.addData)(this, data, consume || false, this.size);
433
436
  }
434
437
  /**
438
+ * Adds data to end of supplied data
439
+ * Note: Must be same data type as supplied data. Errors on strict mode.
440
+ *
441
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
442
+ * @param {boolean} consume - Move current write position to end of data (default false)
443
+ */
444
+ append(data, consume) {
445
+ return (0, common_1.addData)(this, data, consume || false, this.size);
446
+ }
447
+ //
448
+ //finishing
449
+ //
450
+ /**
435
451
  * Returns current data
452
+ *
436
453
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
437
454
  */
438
455
  get() {
@@ -440,35 +457,63 @@ class biwriter {
440
457
  }
441
458
  /**
442
459
  * Returns current data
460
+ *
443
461
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
444
462
  */
445
463
  return() {
446
464
  return this.data;
447
465
  }
448
466
  /**
449
- * removes writing data
467
+ * removes data
450
468
  */
451
469
  end() {
452
470
  this.data = undefined;
453
471
  }
454
472
  /**
455
- * removes writing data
473
+ * removes data
456
474
  */
457
475
  close() {
458
476
  this.data = undefined;
459
477
  }
460
478
  /**
461
- * removes writing data
479
+ * removes data
462
480
  */
463
481
  done() {
464
482
  this.data = undefined;
465
483
  }
466
484
  /**
467
- * removes writing data
485
+ * removes data
468
486
  */
469
487
  finished() {
470
488
  this.data = undefined;
471
489
  }
490
+ /**
491
+ * Console logs data as hex dump
492
+ *
493
+ * @param {object} options - options object
494
+ * ```javascript
495
+ * {
496
+ * length: 192, // number of bytes to log, default 192 or end of data
497
+ * startByte: 0, // byte to start dump, default current position
498
+ * supressUnicode: false // Supress unicode character preview for cleaner columns
499
+ * }
500
+ * ```
501
+ */
502
+ hexdump(options) {
503
+ return (0, common_1.hexDump)(this, options);
504
+ }
505
+ /**
506
+ * Turn hexdump on error off (default on)
507
+ */
508
+ errorDumpOff() {
509
+ this.errorDump = false;
510
+ }
511
+ /**
512
+ * Turn hexdump on error on (default on)
513
+ */
514
+ errorDumpOn() {
515
+ this.errorDump = true;
516
+ }
472
517
  //
473
518
  //bit writer
474
519
  //
@@ -497,6 +542,7 @@ class biwriter {
497
542
  }
498
543
  if (unsigned == true) {
499
544
  if (value < 0 || value > Math.pow(2, bits)) {
545
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
500
546
  throw new Error(`Value is out of range for the specified ${bits}bit length.` + " min: " + 0 + " max: " + Math.pow(2, bits) + " value: " + value);
501
547
  }
502
548
  }
@@ -504,6 +550,7 @@ class biwriter {
504
550
  const maxValue = Math.pow(2, bits - 1) - 1;
505
551
  const minValue = -maxValue - 1;
506
552
  if (value < minValue || value > maxValue) {
553
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
507
554
  throw new Error(`Value is out of range for the specified ${bits}bit length.` + " min: " + minValue + " max: " + maxValue + " value: " + value);
508
555
  }
509
556
  }
@@ -560,22 +607,22 @@ class biwriter {
560
607
  return this.writeBit(value, bits, offsetBits, offsetBytes, unsigned, endian);
561
608
  }
562
609
  /**
563
- * Bit field writer
564
- *
565
- * Note: When returning to a byte read, remaining bits are dropped
566
- *
567
- * @param {number} value - value as int
568
- * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
569
- * @param {number} offsetBytes - byte offset to start the write (default last write position)
570
- * @param {boolean} unsigned - if value is unsigned or not
571
- */
610
+ * Bit field writer
611
+ *
612
+ * Note: When returning to a byte write, remaining bits are dropped
613
+ *
614
+ * @param {number} value - value as int
615
+ * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
616
+ * @param {number} offsetBytes - byte offset to start the write (default last write position)
617
+ * @param {boolean} unsigned - if value is unsigned or not
618
+ */
572
619
  bit1(value, offsetBits, offsetBytes, unsigned) {
573
620
  return this.bit(value, 1, offsetBits, offsetBytes, unsigned);
574
621
  }
575
622
  /**
576
623
  * Bit field writer
577
624
  *
578
- * Note: When returning to a byte read, remaining bits are dropped
625
+ * Note: When returning to a byte write, remaining bits are dropped
579
626
  *
580
627
  * @param {number} value - value as int
581
628
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -587,7 +634,7 @@ class biwriter {
587
634
  /**
588
635
  * Bit field writer
589
636
  *
590
- * Note: When returning to a byte read, remaining bits are dropped
637
+ * Note: When returning to a byte write, remaining bits are dropped
591
638
  *
592
639
  * @param {number} value - value as int
593
640
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -600,7 +647,7 @@ class biwriter {
600
647
  /**
601
648
  * Bit field writer
602
649
  *
603
- * Note: When returning to a byte read, remaining bits are dropped
650
+ * Note: When returning to a byte write, remaining bits are dropped
604
651
  *
605
652
  * @param {number} value - value as int
606
653
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -612,7 +659,7 @@ class biwriter {
612
659
  /**
613
660
  * Bit field writer
614
661
  *
615
- * Note: When returning to a byte read, remaining bits are dropped
662
+ * Note: When returning to a byte write, remaining bits are dropped
616
663
  *
617
664
  * @param {number} value - value as int
618
665
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -625,7 +672,7 @@ class biwriter {
625
672
  /**
626
673
  * Bit field writer
627
674
  *
628
- * Note: When returning to a byte read, remaining bits are dropped
675
+ * Note: When returning to a byte write, remaining bits are dropped
629
676
  *
630
677
  * @param {number} value - value as int
631
678
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -637,7 +684,7 @@ class biwriter {
637
684
  /**
638
685
  * Bit field writer
639
686
  *
640
- * Note: When returning to a byte read, remaining bits are dropped
687
+ * Note: When returning to a byte write, remaining bits are dropped
641
688
  *
642
689
  * @param {number} value - value as int
643
690
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -650,7 +697,7 @@ class biwriter {
650
697
  /**
651
698
  * Bit field writer
652
699
  *
653
- * Note: When returning to a byte read, remaining bits are dropped
700
+ * Note: When returning to a byte write, remaining bits are dropped
654
701
  *
655
702
  * @param {number} value - value as int
656
703
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -662,7 +709,7 @@ class biwriter {
662
709
  /**
663
710
  * Bit field writer
664
711
  *
665
- * Note: When returning to a byte read, remaining bits are dropped
712
+ * Note: When returning to a byte write, remaining bits are dropped
666
713
  *
667
714
  * @param {number} value - value as int
668
715
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -675,7 +722,7 @@ class biwriter {
675
722
  /**
676
723
  * Bit field writer
677
724
  *
678
- * Note: When returning to a byte read, remaining bits are dropped
725
+ * Note: When returning to a byte write, remaining bits are dropped
679
726
  *
680
727
  * @param {number} value - value as int
681
728
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -687,7 +734,7 @@ class biwriter {
687
734
  /**
688
735
  * Bit field writer
689
736
  *
690
- * Note: When returning to a byte read, remaining bits are dropped
737
+ * Note: When returning to a byte write, remaining bits are dropped
691
738
  *
692
739
  * @param {number} value - value as int
693
740
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -700,7 +747,7 @@ class biwriter {
700
747
  /**
701
748
  * Bit field writer
702
749
  *
703
- * Note: When returning to a byte read, remaining bits are dropped
750
+ * Note: When returning to a byte write, remaining bits are dropped
704
751
  *
705
752
  * @param {number} value - value as int
706
753
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -712,7 +759,7 @@ class biwriter {
712
759
  /**
713
760
  * Bit field writer
714
761
  *
715
- * Note: When returning to a byte read, remaining bits are dropped
762
+ * Note: When returning to a byte write, remaining bits are dropped
716
763
  *
717
764
  * @param {number} value - value as int
718
765
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -725,7 +772,7 @@ class biwriter {
725
772
  /**
726
773
  * Bit field writer
727
774
  *
728
- * Note: When returning to a byte read, remaining bits are dropped
775
+ * Note: When returning to a byte write, remaining bits are dropped
729
776
  *
730
777
  * @param {number} value - value as int
731
778
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -737,7 +784,7 @@ class biwriter {
737
784
  /**
738
785
  * Bit field writer
739
786
  *
740
- * Note: When returning to a byte read, remaining bits are dropped
787
+ * Note: When returning to a byte write, remaining bits are dropped
741
788
  *
742
789
  * @param {number} value - value as int
743
790
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -750,7 +797,7 @@ class biwriter {
750
797
  /**
751
798
  * Bit field writer
752
799
  *
753
- * Note: When returning to a byte read, remaining bits are dropped
800
+ * Note: When returning to a byte write, remaining bits are dropped
754
801
  *
755
802
  * @param {number} value - value as int
756
803
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -762,7 +809,7 @@ class biwriter {
762
809
  /**
763
810
  * Bit field writer
764
811
  *
765
- * Note: When returning to a byte read, remaining bits are dropped
812
+ * Note: When returning to a byte write, remaining bits are dropped
766
813
  *
767
814
  * @param {number} value - value as int
768
815
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -775,7 +822,7 @@ class biwriter {
775
822
  /**
776
823
  * Bit field writer
777
824
  *
778
- * Note: When returning to a byte read, remaining bits are dropped
825
+ * Note: When returning to a byte write, remaining bits are dropped
779
826
  *
780
827
  * @param {number} value - value as int
781
828
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -787,7 +834,7 @@ class biwriter {
787
834
  /**
788
835
  * Bit field writer
789
836
  *
790
- * Note: When returning to a byte read, remaining bits are dropped
837
+ * Note: When returning to a byte write, remaining bits are dropped
791
838
  *
792
839
  * @param {number} value - value as int
793
840
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -800,7 +847,7 @@ class biwriter {
800
847
  /**
801
848
  * Bit field writer
802
849
  *
803
- * Note: When returning to a byte read, remaining bits are dropped
850
+ * Note: When returning to a byte write, remaining bits are dropped
804
851
  *
805
852
  * @param {number} value - value as int
806
853
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -812,7 +859,7 @@ class biwriter {
812
859
  /**
813
860
  * Bit field writer
814
861
  *
815
- * Note: When returning to a byte read, remaining bits are dropped
862
+ * Note: When returning to a byte write, remaining bits are dropped
816
863
  *
817
864
  * @param {number} value - value as int
818
865
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -825,7 +872,7 @@ class biwriter {
825
872
  /**
826
873
  * Bit field writer
827
874
  *
828
- * Note: When returning to a byte read, remaining bits are dropped
875
+ * Note: When returning to a byte write, remaining bits are dropped
829
876
  *
830
877
  * @param {number} value - value as int
831
878
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -837,7 +884,7 @@ class biwriter {
837
884
  /**
838
885
  * Bit field writer
839
886
  *
840
- * Note: When returning to a byte read, remaining bits are dropped
887
+ * Note: When returning to a byte write, remaining bits are dropped
841
888
  *
842
889
  * @param {number} value - value as int
843
890
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -850,7 +897,7 @@ class biwriter {
850
897
  /**
851
898
  * Bit field writer
852
899
  *
853
- * Note: When returning to a byte read, remaining bits are dropped
900
+ * Note: When returning to a byte write, remaining bits are dropped
854
901
  *
855
902
  * @param {number} value - value as int
856
903
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -862,7 +909,7 @@ class biwriter {
862
909
  /**
863
910
  * Bit field writer
864
911
  *
865
- * Note: When returning to a byte read, remaining bits are dropped
912
+ * Note: When returning to a byte write, remaining bits are dropped
866
913
  *
867
914
  * @param {number} value - value as int
868
915
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -875,7 +922,7 @@ class biwriter {
875
922
  /**
876
923
  * Bit field writer
877
924
  *
878
- * Note: When returning to a byte read, remaining bits are dropped
925
+ * Note: When returning to a byte write, remaining bits are dropped
879
926
  *
880
927
  * @param {number} value - value as int
881
928
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -887,7 +934,7 @@ class biwriter {
887
934
  /**
888
935
  * Bit field writer
889
936
  *
890
- * Note: When returning to a byte read, remaining bits are dropped
937
+ * Note: When returning to a byte write, remaining bits are dropped
891
938
  *
892
939
  * @param {number} value - value as int
893
940
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -900,7 +947,7 @@ class biwriter {
900
947
  /**
901
948
  * Bit field writer
902
949
  *
903
- * Note: When returning to a byte read, remaining bits are dropped
950
+ * Note: When returning to a byte write, remaining bits are dropped
904
951
  *
905
952
  * @param {number} value - value as int
906
953
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -912,7 +959,7 @@ class biwriter {
912
959
  /**
913
960
  * Bit field writer
914
961
  *
915
- * Note: When returning to a byte read, remaining bits are dropped
962
+ * Note: When returning to a byte write, remaining bits are dropped
916
963
  *
917
964
  * @param {number} value - value as int
918
965
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -925,7 +972,7 @@ class biwriter {
925
972
  /**
926
973
  * Bit field writer
927
974
  *
928
- * Note: When returning to a byte read, remaining bits are dropped
975
+ * Note: When returning to a byte write, remaining bits are dropped
929
976
  *
930
977
  * @param {number} value - value as int
931
978
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -937,7 +984,7 @@ class biwriter {
937
984
  /**
938
985
  * Bit field writer
939
986
  *
940
- * Note: When returning to a byte read, remaining bits are dropped
987
+ * Note: When returning to a byte write, remaining bits are dropped
941
988
  *
942
989
  * @param {number} value - value as int
943
990
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -950,7 +997,7 @@ class biwriter {
950
997
  /**
951
998
  * Bit field writer
952
999
  *
953
- * Note: When returning to a byte read, remaining bits are dropped
1000
+ * Note: When returning to a byte write, remaining bits are dropped
954
1001
  *
955
1002
  * @param {number} value - value as int
956
1003
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -962,7 +1009,7 @@ class biwriter {
962
1009
  /**
963
1010
  * Bit field writer
964
1011
  *
965
- * Note: When returning to a byte read, remaining bits are dropped
1012
+ * Note: When returning to a byte write, remaining bits are dropped
966
1013
  *
967
1014
  * @param {number} value - value as int
968
1015
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -975,7 +1022,7 @@ class biwriter {
975
1022
  /**
976
1023
  * Bit field writer
977
1024
  *
978
- * Note: When returning to a byte read, remaining bits are dropped
1025
+ * Note: When returning to a byte write, remaining bits are dropped
979
1026
  *
980
1027
  * @param {number} value - value as int
981
1028
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -987,7 +1034,7 @@ class biwriter {
987
1034
  /**
988
1035
  * Bit field writer
989
1036
  *
990
- * Note: When returning to a byte read, remaining bits are dropped
1037
+ * Note: When returning to a byte write, remaining bits are dropped
991
1038
  *
992
1039
  * @param {number} value - value as int
993
1040
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1000,7 +1047,7 @@ class biwriter {
1000
1047
  /**
1001
1048
  * Bit field writer
1002
1049
  *
1003
- * Note: When returning to a byte read, remaining bits are dropped
1050
+ * Note: When returning to a byte write, remaining bits are dropped
1004
1051
  *
1005
1052
  * @param {number} value - value as int
1006
1053
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1012,7 +1059,7 @@ class biwriter {
1012
1059
  /**
1013
1060
  * Bit field writer
1014
1061
  *
1015
- * Note: When returning to a byte read, remaining bits are dropped
1062
+ * Note: When returning to a byte write, remaining bits are dropped
1016
1063
  *
1017
1064
  * @param {number} value - value as int
1018
1065
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1025,7 +1072,7 @@ class biwriter {
1025
1072
  /**
1026
1073
  * Bit field writer
1027
1074
  *
1028
- * Note: When returning to a byte read, remaining bits are dropped
1075
+ * Note: When returning to a byte write, remaining bits are dropped
1029
1076
  *
1030
1077
  * @param {number} value - value as int
1031
1078
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1037,7 +1084,7 @@ class biwriter {
1037
1084
  /**
1038
1085
  * Bit field writer
1039
1086
  *
1040
- * Note: When returning to a byte read, remaining bits are dropped
1087
+ * Note: When returning to a byte write, remaining bits are dropped
1041
1088
  *
1042
1089
  * @param {number} value - value as int
1043
1090
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1050,7 +1097,7 @@ class biwriter {
1050
1097
  /**
1051
1098
  * Bit field writer
1052
1099
  *
1053
- * Note: When returning to a byte read, remaining bits are dropped
1100
+ * Note: When returning to a byte write, remaining bits are dropped
1054
1101
  *
1055
1102
  * @param {number} value - value as int
1056
1103
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1062,7 +1109,7 @@ class biwriter {
1062
1109
  /**
1063
1110
  * Bit field writer
1064
1111
  *
1065
- * Note: When returning to a byte read, remaining bits are dropped
1112
+ * Note: When returning to a byte write, remaining bits are dropped
1066
1113
  *
1067
1114
  * @param {number} value - value as int
1068
1115
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1075,7 +1122,7 @@ class biwriter {
1075
1122
  /**
1076
1123
  * Bit field writer
1077
1124
  *
1078
- * Note: When returning to a byte read, remaining bits are dropped
1125
+ * Note: When returning to a byte write, remaining bits are dropped
1079
1126
  *
1080
1127
  * @param {number} value - value as int
1081
1128
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1087,7 +1134,7 @@ class biwriter {
1087
1134
  /**
1088
1135
  * Bit field writer
1089
1136
  *
1090
- * Note: When returning to a byte read, remaining bits are dropped
1137
+ * Note: When returning to a byte write, remaining bits are dropped
1091
1138
  *
1092
1139
  * @param {number} value - value as int
1093
1140
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1100,7 +1147,7 @@ class biwriter {
1100
1147
  /**
1101
1148
  * Bit field writer
1102
1149
  *
1103
- * Note: When returning to a byte read, remaining bits are dropped
1150
+ * Note: When returning to a byte write, remaining bits are dropped
1104
1151
  *
1105
1152
  * @param {number} value - value as int
1106
1153
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1112,7 +1159,7 @@ class biwriter {
1112
1159
  /**
1113
1160
  * Bit field writer
1114
1161
  *
1115
- * Note: When returning to a byte read, remaining bits are dropped
1162
+ * Note: When returning to a byte write, remaining bits are dropped
1116
1163
  *
1117
1164
  * @param {number} value - value as int
1118
1165
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1125,7 +1172,7 @@ class biwriter {
1125
1172
  /**
1126
1173
  * Bit field writer
1127
1174
  *
1128
- * Note: When returning to a byte read, remaining bits are dropped
1175
+ * Note: When returning to a byte write, remaining bits are dropped
1129
1176
  *
1130
1177
  * @param {number} value - value as int
1131
1178
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1137,7 +1184,7 @@ class biwriter {
1137
1184
  /**
1138
1185
  * Bit field writer
1139
1186
  *
1140
- * Note: When returning to a byte read, remaining bits are dropped
1187
+ * Note: When returning to a byte write, remaining bits are dropped
1141
1188
  *
1142
1189
  * @param {number} value - value as int
1143
1190
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1150,7 +1197,7 @@ class biwriter {
1150
1197
  /**
1151
1198
  * Bit field writer
1152
1199
  *
1153
- * Note: When returning to a byte read, remaining bits are dropped
1200
+ * Note: When returning to a byte write, remaining bits are dropped
1154
1201
  *
1155
1202
  * @param {number} value - value as int
1156
1203
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1162,7 +1209,7 @@ class biwriter {
1162
1209
  /**
1163
1210
  * Bit field writer
1164
1211
  *
1165
- * Note: When returning to a byte read, remaining bits are dropped
1212
+ * Note: When returning to a byte write, remaining bits are dropped
1166
1213
  *
1167
1214
  * @param {number} value - value as int
1168
1215
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1175,7 +1222,7 @@ class biwriter {
1175
1222
  /**
1176
1223
  * Bit field writer
1177
1224
  *
1178
- * Note: When returning to a byte read, remaining bits are dropped
1225
+ * Note: When returning to a byte write, remaining bits are dropped
1179
1226
  *
1180
1227
  * @param {number} value - value as int
1181
1228
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1187,7 +1234,7 @@ class biwriter {
1187
1234
  /**
1188
1235
  * Bit field writer
1189
1236
  *
1190
- * Note: When returning to a byte read, remaining bits are dropped
1237
+ * Note: When returning to a byte write, remaining bits are dropped
1191
1238
  *
1192
1239
  * @param {number} value - value as int
1193
1240
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1200,7 +1247,7 @@ class biwriter {
1200
1247
  /**
1201
1248
  * Bit field writer
1202
1249
  *
1203
- * Note: When returning to a byte read, remaining bits are dropped
1250
+ * Note: When returning to a byte write, remaining bits are dropped
1204
1251
  *
1205
1252
  * @param {number} value - value as int
1206
1253
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1212,7 +1259,7 @@ class biwriter {
1212
1259
  /**
1213
1260
  * Bit field writer
1214
1261
  *
1215
- * Note: When returning to a byte read, remaining bits are dropped
1262
+ * Note: When returning to a byte write, remaining bits are dropped
1216
1263
  *
1217
1264
  * @param {number} value - value as int
1218
1265
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1225,7 +1272,7 @@ class biwriter {
1225
1272
  /**
1226
1273
  * Bit field writer
1227
1274
  *
1228
- * Note: When returning to a byte read, remaining bits are dropped
1275
+ * Note: When returning to a byte write, remaining bits are dropped
1229
1276
  *
1230
1277
  * @param {number} value - value as int
1231
1278
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1237,7 +1284,7 @@ class biwriter {
1237
1284
  /**
1238
1285
  * Bit field writer
1239
1286
  *
1240
- * Note: When returning to a byte read, remaining bits are dropped
1287
+ * Note: When returning to a byte write, remaining bits are dropped
1241
1288
  *
1242
1289
  * @param {number} value - value as int
1243
1290
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1250,7 +1297,7 @@ class biwriter {
1250
1297
  /**
1251
1298
  * Bit field writer
1252
1299
  *
1253
- * Note: When returning to a byte read, remaining bits are dropped
1300
+ * Note: When returning to a byte write, remaining bits are dropped
1254
1301
  *
1255
1302
  * @param {number} value - value as int
1256
1303
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1262,7 +1309,7 @@ class biwriter {
1262
1309
  /**
1263
1310
  * Bit field writer
1264
1311
  *
1265
- * Note: When returning to a byte read, remaining bits are dropped
1312
+ * Note: When returning to a byte write, remaining bits are dropped
1266
1313
  *
1267
1314
  * @param {number} value - value as int
1268
1315
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1275,7 +1322,7 @@ class biwriter {
1275
1322
  /**
1276
1323
  * Bit field writer
1277
1324
  *
1278
- * Note: When returning to a byte read, remaining bits are dropped
1325
+ * Note: When returning to a byte write, remaining bits are dropped
1279
1326
  *
1280
1327
  * @param {number} value - value as int
1281
1328
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1287,7 +1334,7 @@ class biwriter {
1287
1334
  /**
1288
1335
  * Bit field writer
1289
1336
  *
1290
- * Note: When returning to a byte read, remaining bits are dropped
1337
+ * Note: When returning to a byte write, remaining bits are dropped
1291
1338
  *
1292
1339
  * @param {number} value - value as int
1293
1340
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1300,7 +1347,7 @@ class biwriter {
1300
1347
  /**
1301
1348
  * Bit field writer
1302
1349
  *
1303
- * Note: When returning to a byte read, remaining bits are dropped
1350
+ * Note: When returning to a byte write, remaining bits are dropped
1304
1351
  *
1305
1352
  * @param {number} value - value as int
1306
1353
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1312,7 +1359,7 @@ class biwriter {
1312
1359
  /**
1313
1360
  * Bit field writer
1314
1361
  *
1315
- * Note: When returning to a byte read, remaining bits are dropped
1362
+ * Note: When returning to a byte write, remaining bits are dropped
1316
1363
  *
1317
1364
  * @param {number} value - value as int
1318
1365
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1325,7 +1372,7 @@ class biwriter {
1325
1372
  /**
1326
1373
  * Bit field writer
1327
1374
  *
1328
- * Note: When returning to a byte read, remaining bits are dropped
1375
+ * Note: When returning to a byte write, remaining bits are dropped
1329
1376
  *
1330
1377
  * @param {number} value - value as int
1331
1378
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1337,7 +1384,7 @@ class biwriter {
1337
1384
  /**
1338
1385
  * Bit field writer
1339
1386
  *
1340
- * Note: When returning to a byte read, remaining bits are dropped
1387
+ * Note: When returning to a byte write, remaining bits are dropped
1341
1388
  *
1342
1389
  * @param {number} value - value as int
1343
1390
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1350,7 +1397,7 @@ class biwriter {
1350
1397
  /**
1351
1398
  * Bit field writer
1352
1399
  *
1353
- * Note: When returning to a byte read, remaining bits are dropped
1400
+ * Note: When returning to a byte write, remaining bits are dropped
1354
1401
  *
1355
1402
  * @param {number} value - value as int
1356
1403
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1362,7 +1409,7 @@ class biwriter {
1362
1409
  /**
1363
1410
  * Bit field writer
1364
1411
  *
1365
- * Note: When returning to a byte read, remaining bits are dropped
1412
+ * Note: When returning to a byte write, remaining bits are dropped
1366
1413
  *
1367
1414
  * @param {number} value - value as int
1368
1415
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1375,7 +1422,7 @@ class biwriter {
1375
1422
  /**
1376
1423
  * Bit field writer
1377
1424
  *
1378
- * Note: When returning to a byte read, remaining bits are dropped
1425
+ * Note: When returning to a byte write, remaining bits are dropped
1379
1426
  *
1380
1427
  * @param {number} value - value as int
1381
1428
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1387,7 +1434,7 @@ class biwriter {
1387
1434
  /**
1388
1435
  * Bit field writer
1389
1436
  *
1390
- * Note: When returning to a byte read, remaining bits are dropped
1437
+ * Note: When returning to a byte write, remaining bits are dropped
1391
1438
  *
1392
1439
  * @param {number} value - value as int
1393
1440
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1400,7 +1447,7 @@ class biwriter {
1400
1447
  /**
1401
1448
  * Bit field writer
1402
1449
  *
1403
- * Note: When returning to a byte read, remaining bits are dropped
1450
+ * Note: When returning to a byte write, remaining bits are dropped
1404
1451
  *
1405
1452
  * @param {number} value - value as int
1406
1453
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1412,7 +1459,7 @@ class biwriter {
1412
1459
  /**
1413
1460
  * Bit field writer
1414
1461
  *
1415
- * Note: When returning to a byte read, remaining bits are dropped
1462
+ * Note: When returning to a byte write, remaining bits are dropped
1416
1463
  *
1417
1464
  * @param {number} value - value as int
1418
1465
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1425,7 +1472,7 @@ class biwriter {
1425
1472
  /**
1426
1473
  * Bit field writer
1427
1474
  *
1428
- * Note: When returning to a byte read, remaining bits are dropped
1475
+ * Note: When returning to a byte write, remaining bits are dropped
1429
1476
  *
1430
1477
  * @param {number} value - value as int
1431
1478
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1437,7 +1484,7 @@ class biwriter {
1437
1484
  /**
1438
1485
  * Bit field writer
1439
1486
  *
1440
- * Note: When returning to a byte read, remaining bits are dropped
1487
+ * Note: When returning to a byte write, remaining bits are dropped
1441
1488
  *
1442
1489
  * @param {number} value - value as int
1443
1490
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1450,7 +1497,7 @@ class biwriter {
1450
1497
  /**
1451
1498
  * Bit field writer
1452
1499
  *
1453
- * Note: When returning to a byte read, remaining bits are dropped
1500
+ * Note: When returning to a byte write, remaining bits are dropped
1454
1501
  *
1455
1502
  * @param {number} value - value as int
1456
1503
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1462,7 +1509,7 @@ class biwriter {
1462
1509
  /**
1463
1510
  * Bit field writer
1464
1511
  *
1465
- * Note: When returning to a byte read, remaining bits are dropped
1512
+ * Note: When returning to a byte write, remaining bits are dropped
1466
1513
  *
1467
1514
  * @param {number} value - value as int
1468
1515
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1475,7 +1522,7 @@ class biwriter {
1475
1522
  /**
1476
1523
  * Bit field writer
1477
1524
  *
1478
- * Note: When returning to a byte read, remaining bits are dropped
1525
+ * Note: When returning to a byte write, remaining bits are dropped
1479
1526
  *
1480
1527
  * @param {number} value - value as int
1481
1528
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1487,7 +1534,7 @@ class biwriter {
1487
1534
  /**
1488
1535
  * Bit field writer
1489
1536
  *
1490
- * Note: When returning to a byte read, remaining bits are dropped
1537
+ * Note: When returning to a byte write, remaining bits are dropped
1491
1538
  *
1492
1539
  * @param {number} value - value as int
1493
1540
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1500,7 +1547,7 @@ class biwriter {
1500
1547
  /**
1501
1548
  * Bit field writer
1502
1549
  *
1503
- * Note: When returning to a byte read, remaining bits are dropped
1550
+ * Note: When returning to a byte write, remaining bits are dropped
1504
1551
  *
1505
1552
  * @param {number} value - value as int
1506
1553
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1512,7 +1559,7 @@ class biwriter {
1512
1559
  /**
1513
1560
  * Bit field writer
1514
1561
  *
1515
- * Note: When returning to a byte read, remaining bits are dropped
1562
+ * Note: When returning to a byte write, remaining bits are dropped
1516
1563
  *
1517
1564
  * @param {number} value - value as int
1518
1565
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1525,7 +1572,7 @@ class biwriter {
1525
1572
  /**
1526
1573
  * Bit field writer
1527
1574
  *
1528
- * Note: When returning to a byte read, remaining bits are dropped
1575
+ * Note: When returning to a byte write, remaining bits are dropped
1529
1576
  *
1530
1577
  * @param {number} value - value as int
1531
1578
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1537,7 +1584,7 @@ class biwriter {
1537
1584
  /**
1538
1585
  * Bit field writer
1539
1586
  *
1540
- * Note: When returning to a byte read, remaining bits are dropped
1587
+ * Note: When returning to a byte write, remaining bits are dropped
1541
1588
  *
1542
1589
  * @param {number} value - value as int
1543
1590
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1550,7 +1597,7 @@ class biwriter {
1550
1597
  /**
1551
1598
  * Bit field writer
1552
1599
  *
1553
- * Note: When returning to a byte read, remaining bits are dropped
1600
+ * Note: When returning to a byte write, remaining bits are dropped
1554
1601
  *
1555
1602
  * @param {number} value - value as int
1556
1603
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1562,7 +1609,7 @@ class biwriter {
1562
1609
  /**
1563
1610
  * Bit field writer
1564
1611
  *
1565
- * Note: When returning to a byte read, remaining bits are dropped
1612
+ * Note: When returning to a byte write, remaining bits are dropped
1566
1613
  *
1567
1614
  * @param {number} value - value as int
1568
1615
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1575,7 +1622,7 @@ class biwriter {
1575
1622
  /**
1576
1623
  * Bit field writer
1577
1624
  *
1578
- * Note: When returning to a byte read, remaining bits are dropped
1625
+ * Note: When returning to a byte write, remaining bits are dropped
1579
1626
  *
1580
1627
  * @param {number} value - value as int
1581
1628
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1587,7 +1634,7 @@ class biwriter {
1587
1634
  /**
1588
1635
  * Bit field writer
1589
1636
  *
1590
- * Note: When returning to a byte read, remaining bits are dropped
1637
+ * Note: When returning to a byte write, remaining bits are dropped
1591
1638
  *
1592
1639
  * @param {number} value - value as int
1593
1640
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1600,7 +1647,7 @@ class biwriter {
1600
1647
  /**
1601
1648
  * Bit field writer
1602
1649
  *
1603
- * Note: When returning to a byte read, remaining bits are dropped
1650
+ * Note: When returning to a byte write, remaining bits are dropped
1604
1651
  *
1605
1652
  * @param {number} value - value as int
1606
1653
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1612,7 +1659,7 @@ class biwriter {
1612
1659
  /**
1613
1660
  * Bit field writer
1614
1661
  *
1615
- * Note: When returning to a byte read, remaining bits are dropped
1662
+ * Note: When returning to a byte write, remaining bits are dropped
1616
1663
  *
1617
1664
  * @param {number} value - value as int
1618
1665
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1625,7 +1672,7 @@ class biwriter {
1625
1672
  /**
1626
1673
  * Bit field writer
1627
1674
  *
1628
- * Note: When returning to a byte read, remaining bits are dropped
1675
+ * Note: When returning to a byte write, remaining bits are dropped
1629
1676
  *
1630
1677
  * @param {number} value - value as int
1631
1678
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1637,7 +1684,7 @@ class biwriter {
1637
1684
  /**
1638
1685
  * Bit field writer
1639
1686
  *
1640
- * Note: When returning to a byte read, remaining bits are dropped
1687
+ * Note: When returning to a byte write, remaining bits are dropped
1641
1688
  *
1642
1689
  * @param {number} value - value as int
1643
1690
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1650,7 +1697,7 @@ class biwriter {
1650
1697
  /**
1651
1698
  * Bit field writer
1652
1699
  *
1653
- * Note: When returning to a byte read, remaining bits are dropped
1700
+ * Note: When returning to a byte write, remaining bits are dropped
1654
1701
  *
1655
1702
  * @param {number} value - value as int
1656
1703
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1662,7 +1709,7 @@ class biwriter {
1662
1709
  /**
1663
1710
  * Bit field writer
1664
1711
  *
1665
- * Note: When returning to a byte read, remaining bits are dropped
1712
+ * Note: When returning to a byte write, remaining bits are dropped
1666
1713
  *
1667
1714
  * @param {number} value - value as int
1668
1715
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1675,7 +1722,7 @@ class biwriter {
1675
1722
  /**
1676
1723
  * Bit field writer
1677
1724
  *
1678
- * Note: When returning to a byte read, remaining bits are dropped
1725
+ * Note: When returning to a byte write, remaining bits are dropped
1679
1726
  *
1680
1727
  * @param {number} value - value as int
1681
1728
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1687,7 +1734,7 @@ class biwriter {
1687
1734
  /**
1688
1735
  * Bit field writer
1689
1736
  *
1690
- * Note: When returning to a byte read, remaining bits are dropped
1737
+ * Note: When returning to a byte write, remaining bits are dropped
1691
1738
  *
1692
1739
  * @param {number} value - value as int
1693
1740
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1700,7 +1747,7 @@ class biwriter {
1700
1747
  /**
1701
1748
  * Bit field writer
1702
1749
  *
1703
- * Note: When returning to a byte read, remaining bits are dropped
1750
+ * Note: When returning to a byte write, remaining bits are dropped
1704
1751
  *
1705
1752
  * @param {number} value - value as int
1706
1753
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1712,7 +1759,7 @@ class biwriter {
1712
1759
  /**
1713
1760
  * Bit field writer
1714
1761
  *
1715
- * Note: When returning to a byte read, remaining bits are dropped
1762
+ * Note: When returning to a byte write, remaining bits are dropped
1716
1763
  *
1717
1764
  * @param {number} value - value as int
1718
1765
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1725,7 +1772,7 @@ class biwriter {
1725
1772
  /**
1726
1773
  * Bit field writer
1727
1774
  *
1728
- * Note: When returning to a byte read, remaining bits are dropped
1775
+ * Note: When returning to a byte write, remaining bits are dropped
1729
1776
  *
1730
1777
  * @param {number} value - value as int
1731
1778
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1737,7 +1784,7 @@ class biwriter {
1737
1784
  /**
1738
1785
  * Bit field writer
1739
1786
  *
1740
- * Note: When returning to a byte read, remaining bits are dropped
1787
+ * Note: When returning to a byte write, remaining bits are dropped
1741
1788
  *
1742
1789
  * @param {number} value - value as int
1743
1790
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1750,7 +1797,7 @@ class biwriter {
1750
1797
  /**
1751
1798
  * Bit field writer
1752
1799
  *
1753
- * Note: When returning to a byte read, remaining bits are dropped
1800
+ * Note: When returning to a byte write, remaining bits are dropped
1754
1801
  *
1755
1802
  * @param {number} value - value as int
1756
1803
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1762,7 +1809,7 @@ class biwriter {
1762
1809
  /**
1763
1810
  * Bit field writer
1764
1811
  *
1765
- * Note: When returning to a byte read, remaining bits are dropped
1812
+ * Note: When returning to a byte write, remaining bits are dropped
1766
1813
  *
1767
1814
  * @param {number} value - value as int
1768
1815
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1775,7 +1822,7 @@ class biwriter {
1775
1822
  /**
1776
1823
  * Bit field writer
1777
1824
  *
1778
- * Note: When returning to a byte read, remaining bits are dropped
1825
+ * Note: When returning to a byte write, remaining bits are dropped
1779
1826
  *
1780
1827
  * @param {number} value - value as int
1781
1828
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1787,7 +1834,7 @@ class biwriter {
1787
1834
  /**
1788
1835
  * Bit field writer
1789
1836
  *
1790
- * Note: When returning to a byte read, remaining bits are dropped
1837
+ * Note: When returning to a byte write, remaining bits are dropped
1791
1838
  *
1792
1839
  * @param {number} value - value as int
1793
1840
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1800,7 +1847,7 @@ class biwriter {
1800
1847
  /**
1801
1848
  * Bit field writer
1802
1849
  *
1803
- * Note: When returning to a byte read, remaining bits are dropped
1850
+ * Note: When returning to a byte write, remaining bits are dropped
1804
1851
  *
1805
1852
  * @param {number} value - value as int
1806
1853
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1812,7 +1859,7 @@ class biwriter {
1812
1859
  /**
1813
1860
  * Bit field writer
1814
1861
  *
1815
- * Note: When returning to a byte read, remaining bits are dropped
1862
+ * Note: When returning to a byte write, remaining bits are dropped
1816
1863
  *
1817
1864
  * @param {number} value - value as int
1818
1865
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1825,7 +1872,7 @@ class biwriter {
1825
1872
  /**
1826
1873
  * Bit field writer
1827
1874
  *
1828
- * Note: When returning to a byte read, remaining bits are dropped
1875
+ * Note: When returning to a byte write, remaining bits are dropped
1829
1876
  *
1830
1877
  * @param {number} value - value as int
1831
1878
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1837,7 +1884,7 @@ class biwriter {
1837
1884
  /**
1838
1885
  * Bit field writer
1839
1886
  *
1840
- * Note: When returning to a byte read, remaining bits are dropped
1887
+ * Note: When returning to a byte write, remaining bits are dropped
1841
1888
  *
1842
1889
  * @param {number} value - value as int
1843
1890
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1850,7 +1897,7 @@ class biwriter {
1850
1897
  /**
1851
1898
  * Bit field writer
1852
1899
  *
1853
- * Note: When returning to a byte read, remaining bits are dropped
1900
+ * Note: When returning to a byte write, remaining bits are dropped
1854
1901
  *
1855
1902
  * @param {number} value - value as int
1856
1903
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1862,7 +1909,7 @@ class biwriter {
1862
1909
  /**
1863
1910
  * Bit field writer
1864
1911
  *
1865
- * Note: When returning to a byte read, remaining bits are dropped
1912
+ * Note: When returning to a byte write, remaining bits are dropped
1866
1913
  *
1867
1914
  * @param {number} value - value as int
1868
1915
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1875,7 +1922,7 @@ class biwriter {
1875
1922
  /**
1876
1923
  * Bit field writer
1877
1924
  *
1878
- * Note: When returning to a byte read, remaining bits are dropped
1925
+ * Note: When returning to a byte write, remaining bits are dropped
1879
1926
  *
1880
1927
  * @param {number} value - value as int
1881
1928
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1887,7 +1934,7 @@ class biwriter {
1887
1934
  /**
1888
1935
  * Bit field writer
1889
1936
  *
1890
- * Note: When returning to a byte read, remaining bits are dropped
1937
+ * Note: When returning to a byte write, remaining bits are dropped
1891
1938
  *
1892
1939
  * @param {number} value - value as int
1893
1940
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1900,7 +1947,7 @@ class biwriter {
1900
1947
  /**
1901
1948
  * Bit field writer
1902
1949
  *
1903
- * Note: When returning to a byte read, remaining bits are dropped
1950
+ * Note: When returning to a byte write, remaining bits are dropped
1904
1951
  *
1905
1952
  * @param {number} value - value as int
1906
1953
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1912,7 +1959,7 @@ class biwriter {
1912
1959
  /**
1913
1960
  * Bit field writer
1914
1961
  *
1915
- * Note: When returning to a byte read, remaining bits are dropped
1962
+ * Note: When returning to a byte write, remaining bits are dropped
1916
1963
  *
1917
1964
  * @param {number} value - value as int
1918
1965
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1925,7 +1972,7 @@ class biwriter {
1925
1972
  /**
1926
1973
  * Bit field writer
1927
1974
  *
1928
- * Note: When returning to a byte read, remaining bits are dropped
1975
+ * Note: When returning to a byte write, remaining bits are dropped
1929
1976
  *
1930
1977
  * @param {number} value - value as int
1931
1978
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1937,7 +1984,7 @@ class biwriter {
1937
1984
  /**
1938
1985
  * Bit field writer
1939
1986
  *
1940
- * Note: When returning to a byte read, remaining bits are dropped
1987
+ * Note: When returning to a byte write, remaining bits are dropped
1941
1988
  *
1942
1989
  * @param {number} value - value as int
1943
1990
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1950,7 +1997,7 @@ class biwriter {
1950
1997
  /**
1951
1998
  * Bit field writer
1952
1999
  *
1953
- * Note: When returning to a byte read, remaining bits are dropped
2000
+ * Note: When returning to a byte write, remaining bits are dropped
1954
2001
  *
1955
2002
  * @param {number} value - value as int
1956
2003
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1962,7 +2009,7 @@ class biwriter {
1962
2009
  /**
1963
2010
  * Bit field writer
1964
2011
  *
1965
- * Note: When returning to a byte read, remaining bits are dropped
2012
+ * Note: When returning to a byte write, remaining bits are dropped
1966
2013
  *
1967
2014
  * @param {number} value - value as int
1968
2015
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1975,7 +2022,7 @@ class biwriter {
1975
2022
  /**
1976
2023
  * Bit field writer
1977
2024
  *
1978
- * Note: When returning to a byte read, remaining bits are dropped
2025
+ * Note: When returning to a byte write, remaining bits are dropped
1979
2026
  *
1980
2027
  * @param {number} value - value as int
1981
2028
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1987,7 +2034,7 @@ class biwriter {
1987
2034
  /**
1988
2035
  * Bit field writer
1989
2036
  *
1990
- * Note: When returning to a byte read, remaining bits are dropped
2037
+ * Note: When returning to a byte write, remaining bits are dropped
1991
2038
  *
1992
2039
  * @param {number} value - value as int
1993
2040
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2000,7 +2047,7 @@ class biwriter {
2000
2047
  /**
2001
2048
  * Bit field writer
2002
2049
  *
2003
- * Note: When returning to a byte read, remaining bits are dropped
2050
+ * Note: When returning to a byte write, remaining bits are dropped
2004
2051
  *
2005
2052
  * @param {number} value - value as int
2006
2053
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2012,7 +2059,7 @@ class biwriter {
2012
2059
  /**
2013
2060
  * Bit field writer
2014
2061
  *
2015
- * Note: When returning to a byte read, remaining bits are dropped
2062
+ * Note: When returning to a byte write, remaining bits are dropped
2016
2063
  *
2017
2064
  * @param {number} value - value as int
2018
2065
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2025,7 +2072,7 @@ class biwriter {
2025
2072
  /**
2026
2073
  * Bit field writer
2027
2074
  *
2028
- * Note: When returning to a byte read, remaining bits are dropped
2075
+ * Note: When returning to a byte write, remaining bits are dropped
2029
2076
  *
2030
2077
  * @param {number} value - value as int
2031
2078
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2037,7 +2084,7 @@ class biwriter {
2037
2084
  /**
2038
2085
  * Bit field writer
2039
2086
  *
2040
- * Note: When returning to a byte read, remaining bits are dropped
2087
+ * Note: When returning to a byte write, remaining bits are dropped
2041
2088
  *
2042
2089
  * @param {number} value - value as int
2043
2090
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2050,7 +2097,7 @@ class biwriter {
2050
2097
  /**
2051
2098
  * Bit field writer
2052
2099
  *
2053
- * Note: When returning to a byte read, remaining bits are dropped
2100
+ * Note: When returning to a byte write, remaining bits are dropped
2054
2101
  *
2055
2102
  * @param {number} value - value as int
2056
2103
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2062,7 +2109,7 @@ class biwriter {
2062
2109
  /**
2063
2110
  * Bit field writer
2064
2111
  *
2065
- * Note: When returning to a byte read, remaining bits are dropped
2112
+ * Note: When returning to a byte write, remaining bits are dropped
2066
2113
  *
2067
2114
  * @param {number} value - value as int
2068
2115
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2075,7 +2122,7 @@ class biwriter {
2075
2122
  /**
2076
2123
  * Bit field writer
2077
2124
  *
2078
- * Note: When returning to a byte read, remaining bits are dropped
2125
+ * Note: When returning to a byte write, remaining bits are dropped
2079
2126
  *
2080
2127
  * @param {number} value - value as int
2081
2128
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2087,7 +2134,7 @@ class biwriter {
2087
2134
  /**
2088
2135
  * Bit field writer
2089
2136
  *
2090
- * Note: When returning to a byte read, remaining bits are dropped
2137
+ * Note: When returning to a byte write, remaining bits are dropped
2091
2138
  *
2092
2139
  * @param {number} value - value as int
2093
2140
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2100,7 +2147,7 @@ class biwriter {
2100
2147
  /**
2101
2148
  * Bit field writer
2102
2149
  *
2103
- * Note: When returning to a byte read, remaining bits are dropped
2150
+ * Note: When returning to a byte write, remaining bits are dropped
2104
2151
  *
2105
2152
  * @param {number} value - value as int
2106
2153
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2112,7 +2159,7 @@ class biwriter {
2112
2159
  /**
2113
2160
  * Bit field writer
2114
2161
  *
2115
- * Note: When returning to a byte read, remaining bits are dropped
2162
+ * Note: When returning to a byte write, remaining bits are dropped
2116
2163
  *
2117
2164
  * @param {number} value - value as int
2118
2165
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2125,7 +2172,7 @@ class biwriter {
2125
2172
  /**
2126
2173
  * Bit field writer
2127
2174
  *
2128
- * Note: When returning to a byte read, remaining bits are dropped
2175
+ * Note: When returning to a byte write, remaining bits are dropped
2129
2176
  *
2130
2177
  * @param {number} value - value as int
2131
2178
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2137,7 +2184,7 @@ class biwriter {
2137
2184
  /**
2138
2185
  * Bit field writer
2139
2186
  *
2140
- * Note: When returning to a byte read, remaining bits are dropped
2187
+ * Note: When returning to a byte write, remaining bits are dropped
2141
2188
  *
2142
2189
  * @param {number} value - value as int
2143
2190
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2150,7 +2197,7 @@ class biwriter {
2150
2197
  /**
2151
2198
  * Bit field writer
2152
2199
  *
2153
- * Note: When returning to a byte read, remaining bits are dropped
2200
+ * Note: When returning to a byte write, remaining bits are dropped
2154
2201
  *
2155
2202
  * @param {number} value - value as int
2156
2203
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2162,7 +2209,7 @@ class biwriter {
2162
2209
  /**
2163
2210
  * Bit field writer
2164
2211
  *
2165
- * Note: When returning to a byte read, remaining bits are dropped
2212
+ * Note: When returning to a byte write, remaining bits are dropped
2166
2213
  *
2167
2214
  * @param {number} value - value as int
2168
2215
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2175,7 +2222,7 @@ class biwriter {
2175
2222
  /**
2176
2223
  * Bit field writer
2177
2224
  *
2178
- * Note: When returning to a byte read, remaining bits are dropped
2225
+ * Note: When returning to a byte write, remaining bits are dropped
2179
2226
  *
2180
2227
  * @param {number} value - value as int
2181
2228
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2187,7 +2234,7 @@ class biwriter {
2187
2234
  /**
2188
2235
  * Bit field writer
2189
2236
  *
2190
- * Note: When returning to a byte read, remaining bits are dropped
2237
+ * Note: When returning to a byte write, remaining bits are dropped
2191
2238
  *
2192
2239
  * @param {number} value - value as int
2193
2240
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2200,7 +2247,7 @@ class biwriter {
2200
2247
  /**
2201
2248
  * Bit field writer
2202
2249
  *
2203
- * Note: When returning to a byte read, remaining bits are dropped
2250
+ * Note: When returning to a byte write, remaining bits are dropped
2204
2251
  *
2205
2252
  * @param {number} value - value as int
2206
2253
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2212,7 +2259,7 @@ class biwriter {
2212
2259
  /**
2213
2260
  * Bit field writer
2214
2261
  *
2215
- * Note: When returning to a byte read, remaining bits are dropped
2262
+ * Note: When returning to a byte write, remaining bits are dropped
2216
2263
  *
2217
2264
  * @param {number} value - value as int
2218
2265
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2225,7 +2272,7 @@ class biwriter {
2225
2272
  /**
2226
2273
  * Bit field writer
2227
2274
  *
2228
- * Note: When returning to a byte read, remaining bits are dropped
2275
+ * Note: When returning to a byte write, remaining bits are dropped
2229
2276
  *
2230
2277
  * @param {number} value - value as int
2231
2278
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2237,7 +2284,7 @@ class biwriter {
2237
2284
  /**
2238
2285
  * Bit field writer
2239
2286
  *
2240
- * Note: When returning to a byte read, remaining bits are dropped
2287
+ * Note: When returning to a byte write, remaining bits are dropped
2241
2288
  *
2242
2289
  * @param {number} value - value as int
2243
2290
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2250,7 +2297,7 @@ class biwriter {
2250
2297
  /**
2251
2298
  * Bit field writer
2252
2299
  *
2253
- * Note: When returning to a byte read, remaining bits are dropped
2300
+ * Note: When returning to a byte write, remaining bits are dropped
2254
2301
  *
2255
2302
  * @param {number} value - value as int
2256
2303
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2262,7 +2309,7 @@ class biwriter {
2262
2309
  /**
2263
2310
  * Bit field writer
2264
2311
  *
2265
- * Note: When returning to a byte read, remaining bits are dropped
2312
+ * Note: When returning to a byte write, remaining bits are dropped
2266
2313
  *
2267
2314
  * @param {number} value - value as int
2268
2315
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2275,7 +2322,7 @@ class biwriter {
2275
2322
  /**
2276
2323
  * Bit field writer
2277
2324
  *
2278
- * Note: When returning to a byte read, remaining bits are dropped
2325
+ * Note: When returning to a byte write, remaining bits are dropped
2279
2326
  *
2280
2327
  * @param {number} value - value as int
2281
2328
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2287,7 +2334,7 @@ class biwriter {
2287
2334
  /**
2288
2335
  * Bit field writer
2289
2336
  *
2290
- * Note: When returning to a byte read, remaining bits are dropped
2337
+ * Note: When returning to a byte write, remaining bits are dropped
2291
2338
  *
2292
2339
  * @param {number} value - value as int
2293
2340
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2300,7 +2347,7 @@ class biwriter {
2300
2347
  /**
2301
2348
  * Bit field writer
2302
2349
  *
2303
- * Note: When returning to a byte read, remaining bits are dropped
2350
+ * Note: When returning to a byte write, remaining bits are dropped
2304
2351
  *
2305
2352
  * @param {number} value - value as int
2306
2353
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2312,7 +2359,7 @@ class biwriter {
2312
2359
  /**
2313
2360
  * Bit field writer
2314
2361
  *
2315
- * Note: When returning to a byte read, remaining bits are dropped
2362
+ * Note: When returning to a byte write, remaining bits are dropped
2316
2363
  *
2317
2364
  * @param {number} value - value as int
2318
2365
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2325,7 +2372,7 @@ class biwriter {
2325
2372
  /**
2326
2373
  * Bit field writer
2327
2374
  *
2328
- * Note: When returning to a byte read, remaining bits are dropped
2375
+ * Note: When returning to a byte write, remaining bits are dropped
2329
2376
  *
2330
2377
  * @param {number} value - value as int
2331
2378
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2337,7 +2384,7 @@ class biwriter {
2337
2384
  /**
2338
2385
  * Bit field writer
2339
2386
  *
2340
- * Note: When returning to a byte read, remaining bits are dropped
2387
+ * Note: When returning to a byte write, remaining bits are dropped
2341
2388
  *
2342
2389
  * @param {number} value - value as int
2343
2390
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2350,7 +2397,7 @@ class biwriter {
2350
2397
  /**
2351
2398
  * Bit field writer
2352
2399
  *
2353
- * Note: When returning to a byte read, remaining bits are dropped
2400
+ * Note: When returning to a byte write, remaining bits are dropped
2354
2401
  *
2355
2402
  * @param {number} value - value as int
2356
2403
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2362,7 +2409,7 @@ class biwriter {
2362
2409
  /**
2363
2410
  * Bit field writer
2364
2411
  *
2365
- * Note: When returning to a byte read, remaining bits are dropped
2412
+ * Note: When returning to a byte write, remaining bits are dropped
2366
2413
  *
2367
2414
  * @param {number} value - value as int
2368
2415
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2375,7 +2422,7 @@ class biwriter {
2375
2422
  /**
2376
2423
  * Bit field writer
2377
2424
  *
2378
- * Note: When returning to a byte read, remaining bits are dropped
2425
+ * Note: When returning to a byte write, remaining bits are dropped
2379
2426
  *
2380
2427
  * @param {number} value - value as int
2381
2428
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2387,7 +2434,7 @@ class biwriter {
2387
2434
  /**
2388
2435
  * Bit field writer
2389
2436
  *
2390
- * Note: When returning to a byte read, remaining bits are dropped
2437
+ * Note: When returning to a byte write, remaining bits are dropped
2391
2438
  *
2392
2439
  * @param {number} value - value as int
2393
2440
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2400,7 +2447,7 @@ class biwriter {
2400
2447
  /**
2401
2448
  * Bit field writer
2402
2449
  *
2403
- * Note: When returning to a byte read, remaining bits are dropped
2450
+ * Note: When returning to a byte write, remaining bits are dropped
2404
2451
  *
2405
2452
  * @param {number} value - value as int
2406
2453
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2412,7 +2459,7 @@ class biwriter {
2412
2459
  /**
2413
2460
  * Bit field writer
2414
2461
  *
2415
- * Note: When returning to a byte read, remaining bits are dropped
2462
+ * Note: When returning to a byte write, remaining bits are dropped
2416
2463
  *
2417
2464
  * @param {number} value - value as int
2418
2465
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2425,7 +2472,7 @@ class biwriter {
2425
2472
  /**
2426
2473
  * Bit field writer
2427
2474
  *
2428
- * Note: When returning to a byte read, remaining bits are dropped
2475
+ * Note: When returning to a byte write, remaining bits are dropped
2429
2476
  *
2430
2477
  * @param {number} value - value as int
2431
2478
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2437,7 +2484,7 @@ class biwriter {
2437
2484
  /**
2438
2485
  * Bit field writer
2439
2486
  *
2440
- * Note: When returning to a byte read, remaining bits are dropped
2487
+ * Note: When returning to a byte write, remaining bits are dropped
2441
2488
  *
2442
2489
  * @param {number} value - value as int
2443
2490
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2450,7 +2497,7 @@ class biwriter {
2450
2497
  /**
2451
2498
  * Bit field writer
2452
2499
  *
2453
- * Note: When returning to a byte read, remaining bits are dropped
2500
+ * Note: When returning to a byte write, remaining bits are dropped
2454
2501
  *
2455
2502
  * @param {number} value - value as int
2456
2503
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2462,7 +2509,7 @@ class biwriter {
2462
2509
  /**
2463
2510
  * Bit field writer
2464
2511
  *
2465
- * Note: When returning to a byte read, remaining bits are dropped
2512
+ * Note: When returning to a byte write, remaining bits are dropped
2466
2513
  *
2467
2514
  * @param {number} value - value as int
2468
2515
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2475,7 +2522,7 @@ class biwriter {
2475
2522
  /**
2476
2523
  * Bit field writer
2477
2524
  *
2478
- * Note: When returning to a byte read, remaining bits are dropped
2525
+ * Note: When returning to a byte write, remaining bits are dropped
2479
2526
  *
2480
2527
  * @param {number} value - value as int
2481
2528
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2487,7 +2534,7 @@ class biwriter {
2487
2534
  /**
2488
2535
  * Bit field writer
2489
2536
  *
2490
- * Note: When returning to a byte read, remaining bits are dropped
2537
+ * Note: When returning to a byte write, remaining bits are dropped
2491
2538
  *
2492
2539
  * @param {number} value - value as int
2493
2540
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2500,7 +2547,7 @@ class biwriter {
2500
2547
  /**
2501
2548
  * Bit field writer
2502
2549
  *
2503
- * Note: When returning to a byte read, remaining bits are dropped
2550
+ * Note: When returning to a byte write, remaining bits are dropped
2504
2551
  *
2505
2552
  * @param {number} value - value as int
2506
2553
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2512,7 +2559,7 @@ class biwriter {
2512
2559
  /**
2513
2560
  * Bit field writer
2514
2561
  *
2515
- * Note: When returning to a byte read, remaining bits are dropped
2562
+ * Note: When returning to a byte write, remaining bits are dropped
2516
2563
  *
2517
2564
  * @param {number} value - value as int
2518
2565
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2525,7 +2572,7 @@ class biwriter {
2525
2572
  /**
2526
2573
  * Bit field writer
2527
2574
  *
2528
- * Note: When returning to a byte read, remaining bits are dropped
2575
+ * Note: When returning to a byte write, remaining bits are dropped
2529
2576
  *
2530
2577
  * @param {number} value - value as int
2531
2578
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2537,7 +2584,7 @@ class biwriter {
2537
2584
  /**
2538
2585
  * Bit field writer
2539
2586
  *
2540
- * Note: When returning to a byte read, remaining bits are dropped
2587
+ * Note: When returning to a byte write, remaining bits are dropped
2541
2588
  *
2542
2589
  * @param {number} value - value as int
2543
2590
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2550,7 +2597,7 @@ class biwriter {
2550
2597
  /**
2551
2598
  * Bit field writer
2552
2599
  *
2553
- * Note: When returning to a byte read, remaining bits are dropped
2600
+ * Note: When returning to a byte write, remaining bits are dropped
2554
2601
  *
2555
2602
  * @param {number} value - value as int
2556
2603
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2562,7 +2609,7 @@ class biwriter {
2562
2609
  /**
2563
2610
  * Bit field writer
2564
2611
  *
2565
- * Note: When returning to a byte read, remaining bits are dropped
2612
+ * Note: When returning to a byte write, remaining bits are dropped
2566
2613
  *
2567
2614
  * @param {number} value - value as int
2568
2615
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2575,7 +2622,7 @@ class biwriter {
2575
2622
  /**
2576
2623
  * Bit field writer
2577
2624
  *
2578
- * Note: When returning to a byte read, remaining bits are dropped
2625
+ * Note: When returning to a byte write, remaining bits are dropped
2579
2626
  *
2580
2627
  * @param {number} value - value as int
2581
2628
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2587,7 +2634,7 @@ class biwriter {
2587
2634
  /**
2588
2635
  * Bit field writer
2589
2636
  *
2590
- * Note: When returning to a byte read, remaining bits are dropped
2637
+ * Note: When returning to a byte write, remaining bits are dropped
2591
2638
  *
2592
2639
  * @param {number} value - value as int
2593
2640
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2600,7 +2647,7 @@ class biwriter {
2600
2647
  /**
2601
2648
  * Bit field writer
2602
2649
  *
2603
- * Note: When returning to a byte read, remaining bits are dropped
2650
+ * Note: When returning to a byte write, remaining bits are dropped
2604
2651
  *
2605
2652
  * @param {number} value - value as int
2606
2653
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2612,7 +2659,7 @@ class biwriter {
2612
2659
  /**
2613
2660
  * Bit field writer
2614
2661
  *
2615
- * Note: When returning to a byte read, remaining bits are dropped
2662
+ * Note: When returning to a byte write, remaining bits are dropped
2616
2663
  *
2617
2664
  * @param {number} value - value as int
2618
2665
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2625,7 +2672,7 @@ class biwriter {
2625
2672
  /**
2626
2673
  * Bit field writer
2627
2674
  *
2628
- * Note: When returning to a byte read, remaining bits are dropped
2675
+ * Note: When returning to a byte write, remaining bits are dropped
2629
2676
  *
2630
2677
  * @param {number} value - value as int
2631
2678
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2637,7 +2684,7 @@ class biwriter {
2637
2684
  /**
2638
2685
  * Bit field writer
2639
2686
  *
2640
- * Note: When returning to a byte read, remaining bits are dropped
2687
+ * Note: When returning to a byte write, remaining bits are dropped
2641
2688
  *
2642
2689
  * @param {number} value - value as int
2643
2690
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2650,7 +2697,7 @@ class biwriter {
2650
2697
  /**
2651
2698
  * Bit field writer
2652
2699
  *
2653
- * Note: When returning to a byte read, remaining bits are dropped
2700
+ * Note: When returning to a byte write, remaining bits are dropped
2654
2701
  *
2655
2702
  * @param {number} value - value as int
2656
2703
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2662,7 +2709,7 @@ class biwriter {
2662
2709
  /**
2663
2710
  * Bit field writer
2664
2711
  *
2665
- * Note: When returning to a byte read, remaining bits are dropped
2712
+ * Note: When returning to a byte write, remaining bits are dropped
2666
2713
  *
2667
2714
  * @param {number} value - value as int
2668
2715
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2675,7 +2722,7 @@ class biwriter {
2675
2722
  /**
2676
2723
  * Bit field writer
2677
2724
  *
2678
- * Note: When returning to a byte read, remaining bits are dropped
2725
+ * Note: When returning to a byte write, remaining bits are dropped
2679
2726
  *
2680
2727
  * @param {number} value - value as int
2681
2728
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2687,7 +2734,7 @@ class biwriter {
2687
2734
  /**
2688
2735
  * Bit field writer
2689
2736
  *
2690
- * Note: When returning to a byte read, remaining bits are dropped
2737
+ * Note: When returning to a byte write, remaining bits are dropped
2691
2738
  *
2692
2739
  * @param {number} value - value as int
2693
2740
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2700,7 +2747,7 @@ class biwriter {
2700
2747
  /**
2701
2748
  * Bit field writer
2702
2749
  *
2703
- * Note: When returning to a byte read, remaining bits are dropped
2750
+ * Note: When returning to a byte write, remaining bits are dropped
2704
2751
  *
2705
2752
  * @param {number} value - value as int
2706
2753
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2712,7 +2759,7 @@ class biwriter {
2712
2759
  /**
2713
2760
  * Bit field writer
2714
2761
  *
2715
- * Note: When returning to a byte read, remaining bits are dropped
2762
+ * Note: When returning to a byte write, remaining bits are dropped
2716
2763
  *
2717
2764
  * @param {number} value - value as int
2718
2765
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2725,7 +2772,7 @@ class biwriter {
2725
2772
  /**
2726
2773
  * Bit field writer
2727
2774
  *
2728
- * Note: When returning to a byte read, remaining bits are dropped
2775
+ * Note: When returning to a byte write, remaining bits are dropped
2729
2776
  *
2730
2777
  * @param {number} value - value as int
2731
2778
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2737,7 +2784,7 @@ class biwriter {
2737
2784
  /**
2738
2785
  * Bit field writer
2739
2786
  *
2740
- * Note: When returning to a byte read, remaining bits are dropped
2787
+ * Note: When returning to a byte write, remaining bits are dropped
2741
2788
  *
2742
2789
  * @param {number} value - value as int
2743
2790
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2750,7 +2797,7 @@ class biwriter {
2750
2797
  /**
2751
2798
  * Bit field writer
2752
2799
  *
2753
- * Note: When returning to a byte read, remaining bits are dropped
2800
+ * Note: When returning to a byte write, remaining bits are dropped
2754
2801
  *
2755
2802
  * @param {number} value - value as int
2756
2803
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2762,7 +2809,7 @@ class biwriter {
2762
2809
  /**
2763
2810
  * Bit field writer
2764
2811
  *
2765
- * Note: When returning to a byte read, remaining bits are dropped
2812
+ * Note: When returning to a byte write, remaining bits are dropped
2766
2813
  *
2767
2814
  * @param {number} value - value as int
2768
2815
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2775,7 +2822,7 @@ class biwriter {
2775
2822
  /**
2776
2823
  * Bit field writer
2777
2824
  *
2778
- * Note: When returning to a byte read, remaining bits are dropped
2825
+ * Note: When returning to a byte write, remaining bits are dropped
2779
2826
  *
2780
2827
  * @param {number} value - value as int
2781
2828
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2787,7 +2834,7 @@ class biwriter {
2787
2834
  /**
2788
2835
  * Bit field writer
2789
2836
  *
2790
- * Note: When returning to a byte read, remaining bits are dropped
2837
+ * Note: When returning to a byte write, remaining bits are dropped
2791
2838
  *
2792
2839
  * @param {number} value - value as int
2793
2840
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2800,7 +2847,7 @@ class biwriter {
2800
2847
  /**
2801
2848
  * Bit field writer
2802
2849
  *
2803
- * Note: When returning to a byte read, remaining bits are dropped
2850
+ * Note: When returning to a byte write, remaining bits are dropped
2804
2851
  *
2805
2852
  * @param {number} value - value as int
2806
2853
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2812,7 +2859,7 @@ class biwriter {
2812
2859
  /**
2813
2860
  * Bit field writer
2814
2861
  *
2815
- * Note: When returning to a byte read, remaining bits are dropped
2862
+ * Note: When returning to a byte write, remaining bits are dropped
2816
2863
  *
2817
2864
  * @param {number} value - value as int
2818
2865
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2825,7 +2872,7 @@ class biwriter {
2825
2872
  /**
2826
2873
  * Bit field writer
2827
2874
  *
2828
- * Note: When returning to a byte read, remaining bits are dropped
2875
+ * Note: When returning to a byte write, remaining bits are dropped
2829
2876
  *
2830
2877
  * @param {number} value - value as int
2831
2878
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2837,7 +2884,7 @@ class biwriter {
2837
2884
  /**
2838
2885
  * Bit field writer
2839
2886
  *
2840
- * Note: When returning to a byte read, remaining bits are dropped
2887
+ * Note: When returning to a byte write, remaining bits are dropped
2841
2888
  *
2842
2889
  * @param {number} value - value as int
2843
2890
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2850,7 +2897,7 @@ class biwriter {
2850
2897
  /**
2851
2898
  * Bit field writer
2852
2899
  *
2853
- * Note: When returning to a byte read, remaining bits are dropped
2900
+ * Note: When returning to a byte write, remaining bits are dropped
2854
2901
  *
2855
2902
  * @param {number} value - value as int
2856
2903
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2862,7 +2909,7 @@ class biwriter {
2862
2909
  /**
2863
2910
  * Bit field writer
2864
2911
  *
2865
- * Note: When returning to a byte read, remaining bits are dropped
2912
+ * Note: When returning to a byte write, remaining bits are dropped
2866
2913
  *
2867
2914
  * @param {number} value - value as int
2868
2915
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2875,7 +2922,7 @@ class biwriter {
2875
2922
  /**
2876
2923
  * Bit field writer
2877
2924
  *
2878
- * Note: When returning to a byte read, remaining bits are dropped
2925
+ * Note: When returning to a byte write, remaining bits are dropped
2879
2926
  *
2880
2927
  * @param {number} value - value as int
2881
2928
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2887,7 +2934,7 @@ class biwriter {
2887
2934
  /**
2888
2935
  * Bit field writer
2889
2936
  *
2890
- * Note: When returning to a byte read, remaining bits are dropped
2937
+ * Note: When returning to a byte write, remaining bits are dropped
2891
2938
  *
2892
2939
  * @param {number} value - value as int
2893
2940
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2900,7 +2947,7 @@ class biwriter {
2900
2947
  /**
2901
2948
  * Bit field writer
2902
2949
  *
2903
- * Note: When returning to a byte read, remaining bits are dropped
2950
+ * Note: When returning to a byte write, remaining bits are dropped
2904
2951
  *
2905
2952
  * @param {number} value - value as int
2906
2953
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2912,7 +2959,7 @@ class biwriter {
2912
2959
  /**
2913
2960
  * Bit field writer
2914
2961
  *
2915
- * Note: When returning to a byte read, remaining bits are dropped
2962
+ * Note: When returning to a byte write, remaining bits are dropped
2916
2963
  *
2917
2964
  * @param {number} value - value as int
2918
2965
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2925,7 +2972,7 @@ class biwriter {
2925
2972
  /**
2926
2973
  * Bit field writer
2927
2974
  *
2928
- * Note: When returning to a byte read, remaining bits are dropped
2975
+ * Note: When returning to a byte write, remaining bits are dropped
2929
2976
  *
2930
2977
  * @param {number} value - value as int
2931
2978
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2937,7 +2984,7 @@ class biwriter {
2937
2984
  /**
2938
2985
  * Bit field writer
2939
2986
  *
2940
- * Note: When returning to a byte read, remaining bits are dropped
2987
+ * Note: When returning to a byte write, remaining bits are dropped
2941
2988
  *
2942
2989
  * @param {number} value - value as int
2943
2990
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2950,7 +2997,7 @@ class biwriter {
2950
2997
  /**
2951
2998
  * Bit field writer
2952
2999
  *
2953
- * Note: When returning to a byte read, remaining bits are dropped
3000
+ * Note: When returning to a byte write, remaining bits are dropped
2954
3001
  *
2955
3002
  * @param {number} value - value as int
2956
3003
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2962,7 +3009,7 @@ class biwriter {
2962
3009
  /**
2963
3010
  * Bit field writer
2964
3011
  *
2965
- * Note: When returning to a byte read, remaining bits are dropped
3012
+ * Note: When returning to a byte write, remaining bits are dropped
2966
3013
  *
2967
3014
  * @param {number} value - value as int
2968
3015
  * @param {number} bits - number of bits to write
@@ -2976,7 +3023,7 @@ class biwriter {
2976
3023
  /**
2977
3024
  * Bit field writer
2978
3025
  *
2979
- * Note: When returning to a byte read, remaining bits are dropped
3026
+ * Note: When returning to a byte write, remaining bits are dropped
2980
3027
  *
2981
3028
  * @param {number} value - value as int
2982
3029
  * @param {number} bits - number of bits to write
@@ -2990,7 +3037,7 @@ class biwriter {
2990
3037
  /**
2991
3038
  * Bit field writer
2992
3039
  *
2993
- * Note: When returning to a byte read, remaining bits are dropped
3040
+ * Note: When returning to a byte write, remaining bits are dropped
2994
3041
  *
2995
3042
  * @param {number} value - value as int
2996
3043
  * @param {number} bits - number of bits to write
@@ -3004,7 +3051,7 @@ class biwriter {
3004
3051
  /**
3005
3052
  * Bit field writer
3006
3053
  *
3007
- * Note: When returning to a byte read, remaining bits are dropped
3054
+ * Note: When returning to a byte write, remaining bits are dropped
3008
3055
  *
3009
3056
  * @param {number} value - value as int
3010
3057
  * @param {number} bits - number of bits to write
@@ -3029,6 +3076,7 @@ class biwriter {
3029
3076
  this.check_size(1, 0, offset);
3030
3077
  if (unsigned == true) {
3031
3078
  if (value < 0 || value > 255) {
3079
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3032
3080
  throw new Error('Value is out of range for the specified 8bit length.' + " min: " + 0 + " max: " + 255 + " value: " + value);
3033
3081
  }
3034
3082
  }
@@ -3036,6 +3084,7 @@ class biwriter {
3036
3084
  const maxValue = Math.pow(2, 8 - 1) - 1;
3037
3085
  const minValue = -maxValue - 1;
3038
3086
  if (value < minValue || value > maxValue) {
3087
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3039
3088
  throw new Error('Value is out of range for the specified 8bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3040
3089
  }
3041
3090
  }
@@ -3104,6 +3153,7 @@ class biwriter {
3104
3153
  this.check_size(2, 0, offset);
3105
3154
  if (unsigned == true) {
3106
3155
  if (value < 0 || value > 65535) {
3156
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3107
3157
  throw new Error('Value is out of range for the specified 16bit length.' + " min: " + 0 + " max: " + 65535 + " value: " + value);
3108
3158
  }
3109
3159
  }
@@ -3111,6 +3161,7 @@ class biwriter {
3111
3161
  const maxValue = Math.pow(2, 16 - 1) - 1;
3112
3162
  const minValue = -maxValue - 1;
3113
3163
  if (value < minValue || value > maxValue) {
3164
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3114
3165
  throw new Error('Value is out of range for the specified 16bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3115
3166
  }
3116
3167
  }
@@ -3356,6 +3407,7 @@ class biwriter {
3356
3407
  const maxValue = 65504;
3357
3408
  const minValue = 5.96e-08;
3358
3409
  if (value < minValue || value > maxValue) {
3410
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3359
3411
  throw new Error('Value is out of range for the specified half float length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3360
3412
  }
3361
3413
  const signMask = 0x8000;
@@ -3481,6 +3533,7 @@ class biwriter {
3481
3533
  this.check_size(4, 0, offset);
3482
3534
  if (unsigned == true) {
3483
3535
  if (value < 0 || value > 4294967295) {
3536
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3484
3537
  throw new Error('Value is out of range for the specified 32bit length.' + " min: " + 0 + " max: " + 4294967295 + " value: " + value);
3485
3538
  }
3486
3539
  }
@@ -3488,6 +3541,7 @@ class biwriter {
3488
3541
  const maxValue = Math.pow(2, 32 - 1) - 1;
3489
3542
  const minValue = -maxValue - 1;
3490
3543
  if (value < minValue || value > maxValue) {
3544
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3491
3545
  throw new Error('Value is out of range for the specified 32bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3492
3546
  }
3493
3547
  }
@@ -3794,6 +3848,7 @@ class biwriter {
3794
3848
  const maxValue = 3.402823466e+38;
3795
3849
  const minValue = 1.175494351e-38;
3796
3850
  if (value < minValue || value > maxValue) {
3851
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3797
3852
  throw new Error('Value is out of range for the specified float length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3798
3853
  }
3799
3854
  let intValue = Float32Array.from([value])[0]; // Convert float to 32-bit integer representation
@@ -3870,6 +3925,7 @@ class biwriter {
3870
3925
  this.check_size(8, 0, offset);
3871
3926
  if (unsigned == true) {
3872
3927
  if (value < 0 || value > Math.pow(2, 64) - 1) {
3928
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3873
3929
  throw new Error('Value is out of range for the specified 64bit length.' + " min: " + 0 + " max: " + (Math.pow(2, 64) - 1) + " value: " + value);
3874
3930
  }
3875
3931
  }
@@ -3877,6 +3933,7 @@ class biwriter {
3877
3933
  const maxValue = Math.pow(2, 63) - 1;
3878
3934
  const minValue = -Math.pow(2, 63);
3879
3935
  if (value < minValue || value > maxValue) {
3936
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3880
3937
  throw new Error('Value is out of range for the specified 64bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3881
3938
  }
3882
3939
  }
@@ -4135,7 +4192,7 @@ class biwriter {
4135
4192
  return this.writeInt64(value, offset, true, "big");
4136
4193
  }
4137
4194
  //
4138
- //doublefloat reader
4195
+ //doublefloat
4139
4196
  //
4140
4197
  /**
4141
4198
  * Writes double float
@@ -4149,6 +4206,7 @@ class biwriter {
4149
4206
  const maxValue = 1.7976931348623158e308;
4150
4207
  const minValue = 2.2250738585072014e-308;
4151
4208
  if (value < minValue || value > maxValue) {
4209
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4152
4210
  throw new Error('Value is out of range for the specified 64bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
4153
4211
  }
4154
4212
  const intArray = new Int32Array(2);
@@ -4339,9 +4397,11 @@ class biwriter {
4339
4397
  maxLength = 4294967295;
4340
4398
  }
4341
4399
  else {
4342
- throw new Error("Invalid length read size: " + lengthWriteSize);
4400
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4401
+ throw new Error("Invalid length write size: " + lengthWriteSize);
4343
4402
  }
4344
4403
  if (string.length > maxLength || (length || 0) > maxLength) {
4404
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4345
4405
  throw new Error("String outsize of max write length: " + maxLength);
4346
4406
  }
4347
4407
  var maxBytes = Math.min(string.length, maxLength);
@@ -4380,7 +4440,7 @@ class biwriter {
4380
4440
  this.offset += totalLength;
4381
4441
  }
4382
4442
  else {
4383
- throw new Error('Unsupported string type.');
4443
+ throw new Error('Unsupported string type: ' + stringType);
4384
4444
  }
4385
4445
  }
4386
4446
  /**