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,11 +1,12 @@
1
+ import { skip, goto, remove, checkSize, addData, hexDump } from './common';
1
2
  /**
2
3
  * Binary writer, includes bitfields and strings
3
4
  *
4
5
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
5
- * @param {number} byteOffset - byte offset to start writer, default is 0
6
- * @param {number} bitOffset - bit offset to start writer, 0-7
7
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
8
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
6
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
7
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
8
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
9
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
9
10
  */
10
11
  export class biwriter {
11
12
  isBuffer(obj) {
@@ -18,43 +19,25 @@ export class biwriter {
18
19
  if ((typeof Buffer !== 'undefined' && this.data instanceof Buffer)) {
19
20
  var paddbuffer = Buffer.alloc(to_padd);
20
21
  this.data = Buffer.concat([this.data, paddbuffer]);
22
+ this.size = this.data.length;
21
23
  }
22
24
  else {
23
25
  const addArray = new Array(to_padd);
24
26
  this.data = new Uint8Array([...this.data, ...addArray]);
27
+ this.size = this.data.length;
25
28
  }
26
29
  }
27
30
  check_size(write_bytes, write_bit, offset) {
28
- const bits = (write_bit || 0) + this.bitoffset;
29
- var new_off = (offset || this.offset);
30
- var writesize = write_bytes || 0;
31
- if (bits != 0) {
32
- //add bits
33
- writesize += Math.ceil(bits / 8);
34
- }
35
- //if biger extend
36
- const needed_size = new_off + writesize;
37
- if (needed_size > this.size) {
38
- const dif = needed_size - this.size;
39
- if (this.strict == false) {
40
- this.extendArray(dif);
41
- }
42
- else {
43
- throw new Error("Location outside of size of data: " + this.size);
44
- }
45
- this.size = this.data.length;
46
- }
47
- //start read location
48
- this.offset = new_off;
31
+ return checkSize(this, write_bytes || 0, write_bit || 0, offset || this.offset);
49
32
  }
50
33
  /**
51
34
  * Binary writer, includes bitfields and strings
52
35
  *
53
36
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
54
- * @param {number} byteOffset - byte offset to start writer, default is 0
55
- * @param {number} bitOffset - bit offset to start writer, 0-7
56
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
57
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
37
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
38
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
39
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
40
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
58
41
  */
59
42
  constructor(data, byteOffset, bitOffset, endianness, strict) {
60
43
  this.endian = "little";
@@ -62,6 +45,7 @@ export class biwriter {
62
45
  this.bitoffset = 0;
63
46
  this.size = 0;
64
47
  this.strict = false;
48
+ this.errorDump = true;
65
49
  this.data = [];
66
50
  if (endianness != undefined && typeof endianness != "string") {
67
51
  throw new Error("endianness must be big or little");
@@ -93,7 +77,7 @@ export class biwriter {
93
77
  throw new Error("Data required");
94
78
  }
95
79
  else {
96
- if (!this.isBufferOrUint8Array(this.data)) {
80
+ if (!this.isBufferOrUint8Array(data)) {
97
81
  throw new Error("Write data must be Uint8Array or Buffer");
98
82
  }
99
83
  }
@@ -101,8 +85,7 @@ export class biwriter {
101
85
  this.size = this.data.length + ((bitOffset || 0) % 8);
102
86
  }
103
87
  /**
104
- *
105
- * Change endian, defaults to little
88
+ * Change endian (default little)
106
89
  *
107
90
  * Can be changed at any time, doesn't loose position
108
91
  *
@@ -118,169 +101,133 @@ export class biwriter {
118
101
  this.endian = endian;
119
102
  }
120
103
  /**
121
- *
122
104
  * Sets endian to big
105
+ *
123
106
  */
124
107
  bigEndian() {
125
108
  this.endianness("big");
126
109
  }
127
110
  /**
128
- *
129
111
  * Sets endian to big
112
+ *
130
113
  */
131
114
  big() {
132
115
  this.endianness("big");
133
116
  }
134
117
  /**
135
- *
136
118
  * Sets endian to big
119
+ *
137
120
  */
138
121
  be() {
139
122
  this.endianness("big");
140
123
  }
141
124
  /**
142
- *
143
125
  * Sets endian to little
126
+ *
144
127
  */
145
128
  littleEndian() {
146
129
  this.endianness("little");
147
130
  }
148
131
  /**
149
- *
150
132
  * Sets endian to little
133
+ *
151
134
  */
152
135
  little() {
153
136
  this.endianness("little");
154
137
  }
155
138
  /**
156
- *
157
139
  * Sets endian to little
140
+ *
158
141
  */
159
142
  le() {
160
143
  this.endianness("little");
161
144
  }
145
+ //
146
+ // move from current position
147
+ //
162
148
  /**
163
- * Move current write byte or bit position, will extend data if outside of current size
149
+ * Offset current byte or bit position
150
+ * Note: Will extend array if strict mode is off and outside of max size
164
151
  *
165
- * @param {number} bytes - bytes to skip
166
- * @param {number} bits - bits to skip (0-7)
152
+ * @param {number} bytes - Bytes to skip
153
+ * @param {number} bits - Bits to skip (0-7)
167
154
  */
168
155
  skip(bytes, bits) {
169
- this.check_size(bytes, bits);
170
- this.offset += (bytes || 0);
171
- this.bitoffset += (bits || 0) % 8;
156
+ return skip(this, bytes, bits);
172
157
  }
173
158
  /**
174
- * Move current write byte or bit position, will extend data if outside of current size
159
+ * Offset current byte or bit position
160
+ * Note: Will extend array if strict mode is off and outside of max size
175
161
  *
176
- * @param {number} bytes - bytes to skip
177
- * @param {number} bits - bits to skip (0-7)
162
+ * @param {number} bytes - Bytes to skip
163
+ * @param {number} bits - Bits to skip (0-7)
178
164
  */
179
- fskip(bytes, bits) {
180
- this.check_size(bytes, bits);
181
- this.offset += (bytes || 0);
182
- this.bitoffset += (bits || 0) % 8;
165
+ jump(bytes, bits) {
166
+ this.skip(bytes, bits);
183
167
  }
168
+ //
169
+ // directly set current position
170
+ //
184
171
  /**
185
- * Change current byte or bit write position, will extend data if outside of current size
172
+ * Change position directly to address
173
+ * Note: Will extend array if strict mode is off and outside of max size
186
174
  *
187
- * @param {number} byte - byte to jump to
188
- * @param {number} bit - bit to jump to (0-7)
175
+ * @param {number} byte - byte to set to
176
+ * @param {number} bit - bit to set to (0-7)
189
177
  */
190
178
  goto(byte, bit) {
191
- const new_size = (byte + Math.ceil((bit || 0) / 8));
192
- if (new_size > this.size && this.strict == false) {
193
- this.extendArray(new_size - this.size);
194
- }
195
- else {
196
- throw new Error("Outside of range of data: " + this.size);
197
- }
198
- this.offset = byte;
199
- this.bitoffset = (bit || 0) % 8;
179
+ return goto(this, byte, bit);
200
180
  }
201
181
  /**
202
- * Change current byte or bit write position, will extend data if outside of current size
182
+ * Change position directly to address
183
+ * Note: Will extend array if strict mode is off and outside of max size
203
184
  *
204
- * @param {number} byte - byte to jump to
205
- * @param {number} bit - bit to jump to (0-7)
185
+ * @param {number} byte - byte to set to
186
+ * @param {number} bit - bit to set to (0-7)
206
187
  */
207
188
  seek(byte, bit) {
208
189
  return this.goto(byte, bit);
209
190
  }
210
191
  /**
211
- * Change current byte or bit write position, will extend data if outside of current size
212
- *
213
- * @param {number} byte - byte to jump to
214
- * @param {number} bit - bit to jump to (0-7)
215
- */
216
- fseek(byte, bit) {
217
- return this.goto(byte, bit);
218
- }
219
- /**
220
- * Change current byte or bit write position, will extend data if outside of current size
192
+ * Change position directly to address
193
+ * Note: Will extend array if strict mode is off and outside of max size
221
194
  *
222
- * @param {number} byte - byte to jump to
223
- * @param {number} bit - bit to jump to (0-7)
224
- */
225
- jump(byte, bit) {
226
- return this.goto(byte, bit);
227
- }
228
- /**
229
- * Change current byte or bit write position, will extend data if outside of current size
230
- *
231
- * @param {number} byte - byte to jump to
232
- * @param {number} bit - bit to jump to (0-7)
195
+ * @param {number} byte - byte to set to
196
+ * @param {number} bit - bit to set to (0-7)
233
197
  */
234
198
  pointer(byte, bit) {
235
199
  return this.goto(byte, bit);
236
200
  }
237
201
  /**
238
- * Change current byte or bit write position, will extend data if outside of current size
202
+ * Change position directly to address
203
+ * Note: Will extend array if strict mode is off and outside of max size
239
204
  *
240
- * @param {number} byte - byte to jump to
241
- * @param {number} bit - bit to jump to (0-7)
205
+ * @param {number} byte - byte to set to
206
+ * @param {number} bit - bit to set to (0-7)
242
207
  */
243
208
  warp(byte, bit) {
244
209
  return this.goto(byte, bit);
245
210
  }
211
+ //
212
+ //go to start
213
+ //
246
214
  /**
247
- * Change current byte or bit write position, will extend data if outside of current size
248
- *
249
- * @param {number} byte - byte to jump to
250
- * @param {number} bit - bit to jump to (0-7)
251
- */
252
- fsetpos(byte, bit) {
253
- return this.goto(byte, bit);
254
- }
255
- /**
256
- * Set offset to start of file
215
+ * Set byte and bit position to start of data
257
216
  */
258
217
  rewind() {
259
218
  this.offset = 0;
260
219
  this.bitoffset = 0;
261
220
  }
262
221
  /**
263
- * Set offset to start of file
222
+ * Set byte and bit position to start of data
264
223
  */
265
224
  gotostart() {
266
225
  this.offset = 0;
267
226
  this.bitoffset = 0;
268
227
  }
269
- /**
270
- * Set offset to start of file
271
- */
272
- tostart() {
273
- this.offset = 0;
274
- this.bitoffset = 0;
275
- }
276
- /**
277
- * Get the current byte position
278
- *
279
- * @return {number} current byte position
280
- */
281
- ftell() {
282
- return this.offset;
283
- }
228
+ //
229
+ //get position
230
+ //
284
231
  /**
285
232
  * Get the current byte position
286
233
  *
@@ -294,7 +241,7 @@ export class biwriter {
294
241
  *
295
242
  * @return {number} current byte position
296
243
  */
297
- fgetpos() {
244
+ getOffset() {
298
245
  return this.offset;
299
246
  }
300
247
  /**
@@ -305,131 +252,201 @@ export class biwriter {
305
252
  saveOffset() {
306
253
  return this.offset;
307
254
  }
255
+ //
256
+ //strict mode change
257
+ //
308
258
  /**
309
- * Disallows extending array if writing outside of max size
259
+ * Disallows extending data if position is outside of max size
310
260
  */
311
261
  restrict() {
312
262
  this.strict = true;
313
263
  }
314
264
  /**
315
- * Allows extending array if writing outside of max size
265
+ * Allows extending data if position is outside of max size
316
266
  */
317
267
  unrestrict() {
318
268
  this.strict = false;
319
269
  }
270
+ //
271
+ //remove part of data
272
+ //
320
273
  /**
321
- * Truncates array from start to current position unless supplied
322
- * Note: Does not affect supplied data
323
- * Note: Will extend array if strict mode is off
324
- * @param {number} startOffset - Start location, default 0
325
- * @param {number} endOffset - end location, default current write position
326
- */
327
- clip(startOffset, endOffset) {
328
- if ((endOffset || this.offset) > this.size) {
329
- if (this.strict == false) {
330
- this.extendArray((endOffset || this.offset) - this.size);
331
- }
332
- else {
333
- throw new Error("End offset outside of data: " + this.size);
334
- }
335
- }
336
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
274
+ * Deletes part of data from start to current byte position unless supplied, returns removed
275
+ * Note: Errors in strict mode
276
+ *
277
+ * @param {number} startOffset - Start location (default 0)
278
+ * @param {number} endOffset - End location (default current position)
279
+ * @param {boolean} consume - Move position to end of removed data (default false)
280
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
281
+ */
282
+ delete(startOffset, endOffset, consume) {
283
+ return remove(this, startOffset || 0, endOffset || this.offset, consume || false, true);
337
284
  }
338
285
  /**
339
- * Truncates array from start to current position unless supplied
340
- * Note: Does not affect supplied data
341
- * Note: Will extend array if strict mode is off
342
- * @param {number} startOffset - Start location, default 0
343
- * @param {number} endOffset - end location, default current write position
344
- */
345
- crop(startOffset, endOffset) {
346
- if ((endOffset || this.offset) > this.size) {
347
- if (this.strict == false) {
348
- this.extendArray((endOffset || this.offset) - this.size);
349
- }
350
- else {
351
- throw new Error("End offset outside of data: " + this.size);
352
- }
353
- }
354
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
286
+ * Deletes part of data from start to current byte position unless supplied, returns removed
287
+ * Note: Errors in strict mode
288
+ *
289
+ * @param {number} startOffset - Start location (default 0)
290
+ * @param {number} endOffset - End location (default current position)
291
+ * @param {boolean} consume - Move position to end of removed data (default false)
292
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
293
+ */
294
+ clip(startOffset, endOffset, consume) {
295
+ return remove(this, startOffset || 0, endOffset || this.offset, consume || false, true);
355
296
  }
356
297
  /**
357
- * Truncates array from start to current position unless supplied
358
- * Note: Does not affect supplied data
359
- * Note: Will extend array if strict mode is off
360
- * @param {number} startOffset - Start location, default 0
361
- * @param {number} endOffset - end location, default current write position
362
- */
363
- truncate(startOffset, endOffset) {
364
- if ((endOffset || this.offset) > this.size) {
365
- if (this.strict == false) {
366
- this.extendArray((endOffset || this.offset) - this.size);
367
- }
368
- else {
369
- throw new Error("End offset outside of data: " + this.size);
370
- }
371
- }
372
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
298
+ * Deletes part of data from current byte position to supplied length, returns removed
299
+ * Note: Errors in strict mode
300
+ *
301
+ * @param {number} length - Length of data in bytes to remove
302
+ * @param {boolean} consume - Move position to end of removed data (default false)
303
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
304
+ */
305
+ crop(length, consume) {
306
+ return remove(this, this.offset, this.offset + (length || 0), consume || false, true);
373
307
  }
374
308
  /**
375
- * Truncates array from start to current position unless supplied
376
- * Note: Does not affect supplied data
377
- * Note: Will extend array if strict mode is off
378
- * @param {number} startOffset - Start location, default 0
379
- * @param {number} endOffset - end location, default current write position
380
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
309
+ * Deletes part of data from current position to supplied length, returns removed
310
+ * Note: Only works in strict mode
311
+ *
312
+ * @param {number} length - Length of data in bytes to remove
313
+ * @param {boolean} consume - Move position to end of removed data (default false)
314
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
381
315
  */
382
- slice(startOffset, endOffset) {
383
- if ((endOffset || this.offset) > this.size) {
384
- if (this.strict == false) {
385
- this.extendArray((endOffset || this.offset) - this.size);
386
- }
387
- else {
388
- throw new Error("End offset outside of data: " + this.size);
389
- }
390
- }
391
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
316
+ drop(length, consume) {
317
+ return remove(this, this.offset, this.offset + (length || 0), consume || false, true);
392
318
  }
319
+ //
320
+ //copy out
321
+ //
393
322
  /**
394
- * Extract array from current position to length supplied
323
+ * Returns part of data from current byte position to end of data unless supplied
324
+ *
325
+ * @param {number} startOffset - Start location (default current position)
326
+ * @param {number} endOffset - End location (default end of data)
327
+ * @param {boolean} consume - Move position to end of lifted data (default false)
328
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
329
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
330
+ */
331
+ lift(startOffset, endOffset, consume, fillValue) {
332
+ return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
333
+ }
334
+ /**
335
+ * Returns part of data from current byte position to end of data unless supplied
336
+ *
337
+ * @param {number} startOffset - Start location (default current position)
338
+ * @param {number} endOffset - End location (default end of data)
339
+ * @param {boolean} consume - Move position to end of lifted data (default false)
340
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
341
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
342
+ */
343
+ fill(startOffset, endOffset, consume, fillValue) {
344
+ return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
345
+ }
346
+ /**
347
+ * Extract data from current position to length supplied
395
348
  * Note: Does not affect supplied data
396
- * Note: Will extend array if strict mode is off
397
- * @param {number} length - length of data to copy from current offset
398
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
349
+ *
350
+ * @param {number} length - Length of data in bytes to copy from current offset
351
+ * @param {number} consume - Moves offset to end of length
352
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
399
353
  */
400
- extract(length) {
401
- if (this.offset + (length || 0) > this.size) {
402
- if (this.strict == false) {
403
- this.extendArray(this.offset + (length || 0) - this.size);
404
- }
405
- else {
406
- throw new Error("End offset outside of data: " + this.size);
407
- }
408
- }
409
- return this.data.slice(this.offset, this.offset + (length || 0));
354
+ extract(length, consume) {
355
+ return remove(this, this.offset, length || 0, consume || false, false);
410
356
  }
411
357
  /**
412
- * Extract array from current position to length supplied
358
+ * Extract data from current position to length supplied
413
359
  * Note: Does not affect supplied data
414
- * Note: Will extend array if strict mode is off
415
- * @param {number} length - length of data to copy from current offset
416
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
360
+ *
361
+ * @param {number} length - Length of data in bytes to copy from current offset
362
+ * @param {number} consume - Moves offset to end of length
363
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
417
364
  */
418
- wrap(length) {
419
- return this.extract(length);
365
+ slice(length, consume) {
366
+ return remove(this, this.offset, length || 0, consume || false, false);
420
367
  }
421
368
  /**
422
- * Extract array from current position to length supplied
369
+ * Extract data from current position to length supplied
423
370
  * Note: Does not affect supplied data
424
- * Note: Will extend array if strict mode is off
425
- * @param {number} length - length of data to copy from current offset
426
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
371
+ *
372
+ * @param {number} length - Length of data in bytes to copy from current offset
373
+ * @param {number} consume - Moves offset to end of length
374
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
375
+ */
376
+ wrap(length, consume) {
377
+ return remove(this, this.offset, length || 0, consume || false, false);
378
+ }
379
+ //
380
+ //insert
381
+ //
382
+ /**
383
+ * Inserts data into data
384
+ * Note: Must be same data type as supplied data. Errors on strict mode.
385
+ *
386
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
387
+ * @param {boolean} consume - Move current write position to end of data (default false)
388
+ * @param {number} offset - Offset to add it at (defaults to current position)
389
+ */
390
+ insert(data, consume, offset) {
391
+ return addData(this, data, consume || false, offset || this.offset);
392
+ }
393
+ /**
394
+ * Inserts data into data
395
+ * Note: Must be same data type as supplied data. Errors on strict mode.
396
+ *
397
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
398
+ * @param {boolean} consume - Move current write position to end of data (default false)
399
+ * @param {number} offset - Offset to add it at (defaults to current position)
400
+ */
401
+ place(data, consume, offset) {
402
+ return addData(this, data, consume || false, offset || this.offset);
403
+ }
404
+ /**
405
+ * Adds data to start of supplied data
406
+ * Note: Must be same data type as supplied data. Errors on strict mode.
407
+ *
408
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
409
+ * @param {boolean} consume - Move current write position to end of data (default false)
410
+ */
411
+ unshift(data, consume) {
412
+ return addData(this, data, consume || false, 0);
413
+ }
414
+ /**
415
+ * Adds data to start of supplied data
416
+ * Note: Must be same data type as supplied data. Errors on strict mode.
417
+ *
418
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
419
+ * @param {boolean} consume - Move current write position to end of data (default false)
420
+ */
421
+ prepend(data, consume) {
422
+ return addData(this, data, consume || false, 0);
423
+ }
424
+ /**
425
+ * Adds data to end of supplied data
426
+ * Note: Must be same data type as supplied data. Errors on strict mode.
427
+ *
428
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
429
+ * @param {boolean} consume - Move current write position to end of data (default false)
427
430
  */
428
- lift(length) {
429
- return this.extract(length);
431
+ push(data, consume) {
432
+ return addData(this, data, consume || false, this.size);
430
433
  }
431
434
  /**
435
+ * Adds data to end of supplied data
436
+ * Note: Must be same data type as supplied data. Errors on strict mode.
437
+ *
438
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
439
+ * @param {boolean} consume - Move current write position to end of data (default false)
440
+ */
441
+ append(data, consume) {
442
+ return addData(this, data, consume || false, this.size);
443
+ }
444
+ //
445
+ //finishing
446
+ //
447
+ /**
432
448
  * Returns current data
449
+ *
433
450
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
434
451
  */
435
452
  get() {
@@ -437,35 +454,63 @@ export class biwriter {
437
454
  }
438
455
  /**
439
456
  * Returns current data
457
+ *
440
458
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
441
459
  */
442
460
  return() {
443
461
  return this.data;
444
462
  }
445
463
  /**
446
- * removes writing data
464
+ * removes data
447
465
  */
448
466
  end() {
449
467
  this.data = undefined;
450
468
  }
451
469
  /**
452
- * removes writing data
470
+ * removes data
453
471
  */
454
472
  close() {
455
473
  this.data = undefined;
456
474
  }
457
475
  /**
458
- * removes writing data
476
+ * removes data
459
477
  */
460
478
  done() {
461
479
  this.data = undefined;
462
480
  }
463
481
  /**
464
- * removes writing data
482
+ * removes data
465
483
  */
466
484
  finished() {
467
485
  this.data = undefined;
468
486
  }
487
+ /**
488
+ * Console logs data as hex dump
489
+ *
490
+ * @param {object} options - options object
491
+ * ```javascript
492
+ * {
493
+ * length: 192, // number of bytes to log, default 192 or end of data
494
+ * startByte: 0, // byte to start dump, default current position
495
+ * supressUnicode: false // Supress unicode character preview for cleaner columns
496
+ * }
497
+ * ```
498
+ */
499
+ hexdump(options) {
500
+ return hexDump(this, options);
501
+ }
502
+ /**
503
+ * Turn hexdump on error off (default on)
504
+ */
505
+ errorDumpOff() {
506
+ this.errorDump = false;
507
+ }
508
+ /**
509
+ * Turn hexdump on error on (default on)
510
+ */
511
+ errorDumpOn() {
512
+ this.errorDump = true;
513
+ }
469
514
  //
470
515
  //bit writer
471
516
  //
@@ -494,6 +539,7 @@ export class biwriter {
494
539
  }
495
540
  if (unsigned == true) {
496
541
  if (value < 0 || value > Math.pow(2, bits)) {
542
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
497
543
  throw new Error(`Value is out of range for the specified ${bits}bit length.` + " min: " + 0 + " max: " + Math.pow(2, bits) + " value: " + value);
498
544
  }
499
545
  }
@@ -501,6 +547,7 @@ export class biwriter {
501
547
  const maxValue = Math.pow(2, bits - 1) - 1;
502
548
  const minValue = -maxValue - 1;
503
549
  if (value < minValue || value > maxValue) {
550
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
504
551
  throw new Error(`Value is out of range for the specified ${bits}bit length.` + " min: " + minValue + " max: " + maxValue + " value: " + value);
505
552
  }
506
553
  }
@@ -557,22 +604,22 @@ export class biwriter {
557
604
  return this.writeBit(value, bits, offsetBits, offsetBytes, unsigned, endian);
558
605
  }
559
606
  /**
560
- * Bit field writer
561
- *
562
- * Note: When returning to a byte read, remaining bits are dropped
563
- *
564
- * @param {number} value - value as int
565
- * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
566
- * @param {number} offsetBytes - byte offset to start the write (default last write position)
567
- * @param {boolean} unsigned - if value is unsigned or not
568
- */
607
+ * Bit field writer
608
+ *
609
+ * Note: When returning to a byte write, remaining bits are dropped
610
+ *
611
+ * @param {number} value - value as int
612
+ * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
613
+ * @param {number} offsetBytes - byte offset to start the write (default last write position)
614
+ * @param {boolean} unsigned - if value is unsigned or not
615
+ */
569
616
  bit1(value, offsetBits, offsetBytes, unsigned) {
570
617
  return this.bit(value, 1, offsetBits, offsetBytes, unsigned);
571
618
  }
572
619
  /**
573
620
  * Bit field writer
574
621
  *
575
- * Note: When returning to a byte read, remaining bits are dropped
622
+ * Note: When returning to a byte write, remaining bits are dropped
576
623
  *
577
624
  * @param {number} value - value as int
578
625
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -584,7 +631,7 @@ export class biwriter {
584
631
  /**
585
632
  * Bit field writer
586
633
  *
587
- * Note: When returning to a byte read, remaining bits are dropped
634
+ * Note: When returning to a byte write, remaining bits are dropped
588
635
  *
589
636
  * @param {number} value - value as int
590
637
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -597,7 +644,7 @@ export class biwriter {
597
644
  /**
598
645
  * Bit field writer
599
646
  *
600
- * Note: When returning to a byte read, remaining bits are dropped
647
+ * Note: When returning to a byte write, remaining bits are dropped
601
648
  *
602
649
  * @param {number} value - value as int
603
650
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -609,7 +656,7 @@ export class biwriter {
609
656
  /**
610
657
  * Bit field writer
611
658
  *
612
- * Note: When returning to a byte read, remaining bits are dropped
659
+ * Note: When returning to a byte write, remaining bits are dropped
613
660
  *
614
661
  * @param {number} value - value as int
615
662
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -622,7 +669,7 @@ export class biwriter {
622
669
  /**
623
670
  * Bit field writer
624
671
  *
625
- * Note: When returning to a byte read, remaining bits are dropped
672
+ * Note: When returning to a byte write, remaining bits are dropped
626
673
  *
627
674
  * @param {number} value - value as int
628
675
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -634,7 +681,7 @@ export class biwriter {
634
681
  /**
635
682
  * Bit field writer
636
683
  *
637
- * Note: When returning to a byte read, remaining bits are dropped
684
+ * Note: When returning to a byte write, remaining bits are dropped
638
685
  *
639
686
  * @param {number} value - value as int
640
687
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -647,7 +694,7 @@ export class biwriter {
647
694
  /**
648
695
  * Bit field writer
649
696
  *
650
- * Note: When returning to a byte read, remaining bits are dropped
697
+ * Note: When returning to a byte write, remaining bits are dropped
651
698
  *
652
699
  * @param {number} value - value as int
653
700
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -659,7 +706,7 @@ export class biwriter {
659
706
  /**
660
707
  * Bit field writer
661
708
  *
662
- * Note: When returning to a byte read, remaining bits are dropped
709
+ * Note: When returning to a byte write, remaining bits are dropped
663
710
  *
664
711
  * @param {number} value - value as int
665
712
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -672,7 +719,7 @@ export class biwriter {
672
719
  /**
673
720
  * Bit field writer
674
721
  *
675
- * Note: When returning to a byte read, remaining bits are dropped
722
+ * Note: When returning to a byte write, remaining bits are dropped
676
723
  *
677
724
  * @param {number} value - value as int
678
725
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -684,7 +731,7 @@ export class biwriter {
684
731
  /**
685
732
  * Bit field writer
686
733
  *
687
- * Note: When returning to a byte read, remaining bits are dropped
734
+ * Note: When returning to a byte write, remaining bits are dropped
688
735
  *
689
736
  * @param {number} value - value as int
690
737
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -697,7 +744,7 @@ export class biwriter {
697
744
  /**
698
745
  * Bit field writer
699
746
  *
700
- * Note: When returning to a byte read, remaining bits are dropped
747
+ * Note: When returning to a byte write, remaining bits are dropped
701
748
  *
702
749
  * @param {number} value - value as int
703
750
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -709,7 +756,7 @@ export class biwriter {
709
756
  /**
710
757
  * Bit field writer
711
758
  *
712
- * Note: When returning to a byte read, remaining bits are dropped
759
+ * Note: When returning to a byte write, remaining bits are dropped
713
760
  *
714
761
  * @param {number} value - value as int
715
762
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -722,7 +769,7 @@ export class biwriter {
722
769
  /**
723
770
  * Bit field writer
724
771
  *
725
- * Note: When returning to a byte read, remaining bits are dropped
772
+ * Note: When returning to a byte write, remaining bits are dropped
726
773
  *
727
774
  * @param {number} value - value as int
728
775
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -734,7 +781,7 @@ export class biwriter {
734
781
  /**
735
782
  * Bit field writer
736
783
  *
737
- * Note: When returning to a byte read, remaining bits are dropped
784
+ * Note: When returning to a byte write, remaining bits are dropped
738
785
  *
739
786
  * @param {number} value - value as int
740
787
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -747,7 +794,7 @@ export class biwriter {
747
794
  /**
748
795
  * Bit field writer
749
796
  *
750
- * Note: When returning to a byte read, remaining bits are dropped
797
+ * Note: When returning to a byte write, remaining bits are dropped
751
798
  *
752
799
  * @param {number} value - value as int
753
800
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -759,7 +806,7 @@ export class biwriter {
759
806
  /**
760
807
  * Bit field writer
761
808
  *
762
- * Note: When returning to a byte read, remaining bits are dropped
809
+ * Note: When returning to a byte write, remaining bits are dropped
763
810
  *
764
811
  * @param {number} value - value as int
765
812
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -772,7 +819,7 @@ export class biwriter {
772
819
  /**
773
820
  * Bit field writer
774
821
  *
775
- * Note: When returning to a byte read, remaining bits are dropped
822
+ * Note: When returning to a byte write, remaining bits are dropped
776
823
  *
777
824
  * @param {number} value - value as int
778
825
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -784,7 +831,7 @@ export class biwriter {
784
831
  /**
785
832
  * Bit field writer
786
833
  *
787
- * Note: When returning to a byte read, remaining bits are dropped
834
+ * Note: When returning to a byte write, remaining bits are dropped
788
835
  *
789
836
  * @param {number} value - value as int
790
837
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -797,7 +844,7 @@ export class biwriter {
797
844
  /**
798
845
  * Bit field writer
799
846
  *
800
- * Note: When returning to a byte read, remaining bits are dropped
847
+ * Note: When returning to a byte write, remaining bits are dropped
801
848
  *
802
849
  * @param {number} value - value as int
803
850
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -809,7 +856,7 @@ export class biwriter {
809
856
  /**
810
857
  * Bit field writer
811
858
  *
812
- * Note: When returning to a byte read, remaining bits are dropped
859
+ * Note: When returning to a byte write, remaining bits are dropped
813
860
  *
814
861
  * @param {number} value - value as int
815
862
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -822,7 +869,7 @@ export class biwriter {
822
869
  /**
823
870
  * Bit field writer
824
871
  *
825
- * Note: When returning to a byte read, remaining bits are dropped
872
+ * Note: When returning to a byte write, remaining bits are dropped
826
873
  *
827
874
  * @param {number} value - value as int
828
875
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -834,7 +881,7 @@ export class biwriter {
834
881
  /**
835
882
  * Bit field writer
836
883
  *
837
- * Note: When returning to a byte read, remaining bits are dropped
884
+ * Note: When returning to a byte write, remaining bits are dropped
838
885
  *
839
886
  * @param {number} value - value as int
840
887
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -847,7 +894,7 @@ export class biwriter {
847
894
  /**
848
895
  * Bit field writer
849
896
  *
850
- * Note: When returning to a byte read, remaining bits are dropped
897
+ * Note: When returning to a byte write, remaining bits are dropped
851
898
  *
852
899
  * @param {number} value - value as int
853
900
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -859,7 +906,7 @@ export class biwriter {
859
906
  /**
860
907
  * Bit field writer
861
908
  *
862
- * Note: When returning to a byte read, remaining bits are dropped
909
+ * Note: When returning to a byte write, remaining bits are dropped
863
910
  *
864
911
  * @param {number} value - value as int
865
912
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -872,7 +919,7 @@ export class biwriter {
872
919
  /**
873
920
  * Bit field writer
874
921
  *
875
- * Note: When returning to a byte read, remaining bits are dropped
922
+ * Note: When returning to a byte write, remaining bits are dropped
876
923
  *
877
924
  * @param {number} value - value as int
878
925
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -884,7 +931,7 @@ export class biwriter {
884
931
  /**
885
932
  * Bit field writer
886
933
  *
887
- * Note: When returning to a byte read, remaining bits are dropped
934
+ * Note: When returning to a byte write, remaining bits are dropped
888
935
  *
889
936
  * @param {number} value - value as int
890
937
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -897,7 +944,7 @@ export class biwriter {
897
944
  /**
898
945
  * Bit field writer
899
946
  *
900
- * Note: When returning to a byte read, remaining bits are dropped
947
+ * Note: When returning to a byte write, remaining bits are dropped
901
948
  *
902
949
  * @param {number} value - value as int
903
950
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -909,7 +956,7 @@ export class biwriter {
909
956
  /**
910
957
  * Bit field writer
911
958
  *
912
- * Note: When returning to a byte read, remaining bits are dropped
959
+ * Note: When returning to a byte write, remaining bits are dropped
913
960
  *
914
961
  * @param {number} value - value as int
915
962
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -922,7 +969,7 @@ export class biwriter {
922
969
  /**
923
970
  * Bit field writer
924
971
  *
925
- * Note: When returning to a byte read, remaining bits are dropped
972
+ * Note: When returning to a byte write, remaining bits are dropped
926
973
  *
927
974
  * @param {number} value - value as int
928
975
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -934,7 +981,7 @@ export class biwriter {
934
981
  /**
935
982
  * Bit field writer
936
983
  *
937
- * Note: When returning to a byte read, remaining bits are dropped
984
+ * Note: When returning to a byte write, remaining bits are dropped
938
985
  *
939
986
  * @param {number} value - value as int
940
987
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -947,7 +994,7 @@ export class biwriter {
947
994
  /**
948
995
  * Bit field writer
949
996
  *
950
- * Note: When returning to a byte read, remaining bits are dropped
997
+ * Note: When returning to a byte write, remaining bits are dropped
951
998
  *
952
999
  * @param {number} value - value as int
953
1000
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -959,7 +1006,7 @@ export class biwriter {
959
1006
  /**
960
1007
  * Bit field writer
961
1008
  *
962
- * Note: When returning to a byte read, remaining bits are dropped
1009
+ * Note: When returning to a byte write, remaining bits are dropped
963
1010
  *
964
1011
  * @param {number} value - value as int
965
1012
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -972,7 +1019,7 @@ export class biwriter {
972
1019
  /**
973
1020
  * Bit field writer
974
1021
  *
975
- * Note: When returning to a byte read, remaining bits are dropped
1022
+ * Note: When returning to a byte write, remaining bits are dropped
976
1023
  *
977
1024
  * @param {number} value - value as int
978
1025
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -984,7 +1031,7 @@ export class biwriter {
984
1031
  /**
985
1032
  * Bit field writer
986
1033
  *
987
- * Note: When returning to a byte read, remaining bits are dropped
1034
+ * Note: When returning to a byte write, remaining bits are dropped
988
1035
  *
989
1036
  * @param {number} value - value as int
990
1037
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -997,7 +1044,7 @@ export class biwriter {
997
1044
  /**
998
1045
  * Bit field writer
999
1046
  *
1000
- * Note: When returning to a byte read, remaining bits are dropped
1047
+ * Note: When returning to a byte write, remaining bits are dropped
1001
1048
  *
1002
1049
  * @param {number} value - value as int
1003
1050
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1009,7 +1056,7 @@ export class biwriter {
1009
1056
  /**
1010
1057
  * Bit field writer
1011
1058
  *
1012
- * Note: When returning to a byte read, remaining bits are dropped
1059
+ * Note: When returning to a byte write, remaining bits are dropped
1013
1060
  *
1014
1061
  * @param {number} value - value as int
1015
1062
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1022,7 +1069,7 @@ export class biwriter {
1022
1069
  /**
1023
1070
  * Bit field writer
1024
1071
  *
1025
- * Note: When returning to a byte read, remaining bits are dropped
1072
+ * Note: When returning to a byte write, remaining bits are dropped
1026
1073
  *
1027
1074
  * @param {number} value - value as int
1028
1075
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1034,7 +1081,7 @@ export class biwriter {
1034
1081
  /**
1035
1082
  * Bit field writer
1036
1083
  *
1037
- * Note: When returning to a byte read, remaining bits are dropped
1084
+ * Note: When returning to a byte write, remaining bits are dropped
1038
1085
  *
1039
1086
  * @param {number} value - value as int
1040
1087
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1047,7 +1094,7 @@ export class biwriter {
1047
1094
  /**
1048
1095
  * Bit field writer
1049
1096
  *
1050
- * Note: When returning to a byte read, remaining bits are dropped
1097
+ * Note: When returning to a byte write, remaining bits are dropped
1051
1098
  *
1052
1099
  * @param {number} value - value as int
1053
1100
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1059,7 +1106,7 @@ export class biwriter {
1059
1106
  /**
1060
1107
  * Bit field writer
1061
1108
  *
1062
- * Note: When returning to a byte read, remaining bits are dropped
1109
+ * Note: When returning to a byte write, remaining bits are dropped
1063
1110
  *
1064
1111
  * @param {number} value - value as int
1065
1112
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1072,7 +1119,7 @@ export class biwriter {
1072
1119
  /**
1073
1120
  * Bit field writer
1074
1121
  *
1075
- * Note: When returning to a byte read, remaining bits are dropped
1122
+ * Note: When returning to a byte write, remaining bits are dropped
1076
1123
  *
1077
1124
  * @param {number} value - value as int
1078
1125
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1084,7 +1131,7 @@ export class biwriter {
1084
1131
  /**
1085
1132
  * Bit field writer
1086
1133
  *
1087
- * Note: When returning to a byte read, remaining bits are dropped
1134
+ * Note: When returning to a byte write, remaining bits are dropped
1088
1135
  *
1089
1136
  * @param {number} value - value as int
1090
1137
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1097,7 +1144,7 @@ export class biwriter {
1097
1144
  /**
1098
1145
  * Bit field writer
1099
1146
  *
1100
- * Note: When returning to a byte read, remaining bits are dropped
1147
+ * Note: When returning to a byte write, remaining bits are dropped
1101
1148
  *
1102
1149
  * @param {number} value - value as int
1103
1150
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1109,7 +1156,7 @@ export class biwriter {
1109
1156
  /**
1110
1157
  * Bit field writer
1111
1158
  *
1112
- * Note: When returning to a byte read, remaining bits are dropped
1159
+ * Note: When returning to a byte write, remaining bits are dropped
1113
1160
  *
1114
1161
  * @param {number} value - value as int
1115
1162
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1122,7 +1169,7 @@ export class biwriter {
1122
1169
  /**
1123
1170
  * Bit field writer
1124
1171
  *
1125
- * Note: When returning to a byte read, remaining bits are dropped
1172
+ * Note: When returning to a byte write, remaining bits are dropped
1126
1173
  *
1127
1174
  * @param {number} value - value as int
1128
1175
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1134,7 +1181,7 @@ export class biwriter {
1134
1181
  /**
1135
1182
  * Bit field writer
1136
1183
  *
1137
- * Note: When returning to a byte read, remaining bits are dropped
1184
+ * Note: When returning to a byte write, remaining bits are dropped
1138
1185
  *
1139
1186
  * @param {number} value - value as int
1140
1187
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1147,7 +1194,7 @@ export class biwriter {
1147
1194
  /**
1148
1195
  * Bit field writer
1149
1196
  *
1150
- * Note: When returning to a byte read, remaining bits are dropped
1197
+ * Note: When returning to a byte write, remaining bits are dropped
1151
1198
  *
1152
1199
  * @param {number} value - value as int
1153
1200
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1159,7 +1206,7 @@ export class biwriter {
1159
1206
  /**
1160
1207
  * Bit field writer
1161
1208
  *
1162
- * Note: When returning to a byte read, remaining bits are dropped
1209
+ * Note: When returning to a byte write, remaining bits are dropped
1163
1210
  *
1164
1211
  * @param {number} value - value as int
1165
1212
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1172,7 +1219,7 @@ export class biwriter {
1172
1219
  /**
1173
1220
  * Bit field writer
1174
1221
  *
1175
- * Note: When returning to a byte read, remaining bits are dropped
1222
+ * Note: When returning to a byte write, remaining bits are dropped
1176
1223
  *
1177
1224
  * @param {number} value - value as int
1178
1225
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1184,7 +1231,7 @@ export class biwriter {
1184
1231
  /**
1185
1232
  * Bit field writer
1186
1233
  *
1187
- * Note: When returning to a byte read, remaining bits are dropped
1234
+ * Note: When returning to a byte write, remaining bits are dropped
1188
1235
  *
1189
1236
  * @param {number} value - value as int
1190
1237
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1197,7 +1244,7 @@ export class biwriter {
1197
1244
  /**
1198
1245
  * Bit field writer
1199
1246
  *
1200
- * Note: When returning to a byte read, remaining bits are dropped
1247
+ * Note: When returning to a byte write, remaining bits are dropped
1201
1248
  *
1202
1249
  * @param {number} value - value as int
1203
1250
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1209,7 +1256,7 @@ export class biwriter {
1209
1256
  /**
1210
1257
  * Bit field writer
1211
1258
  *
1212
- * Note: When returning to a byte read, remaining bits are dropped
1259
+ * Note: When returning to a byte write, remaining bits are dropped
1213
1260
  *
1214
1261
  * @param {number} value - value as int
1215
1262
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1222,7 +1269,7 @@ export class biwriter {
1222
1269
  /**
1223
1270
  * Bit field writer
1224
1271
  *
1225
- * Note: When returning to a byte read, remaining bits are dropped
1272
+ * Note: When returning to a byte write, remaining bits are dropped
1226
1273
  *
1227
1274
  * @param {number} value - value as int
1228
1275
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1234,7 +1281,7 @@ export class biwriter {
1234
1281
  /**
1235
1282
  * Bit field writer
1236
1283
  *
1237
- * Note: When returning to a byte read, remaining bits are dropped
1284
+ * Note: When returning to a byte write, remaining bits are dropped
1238
1285
  *
1239
1286
  * @param {number} value - value as int
1240
1287
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1247,7 +1294,7 @@ export class biwriter {
1247
1294
  /**
1248
1295
  * Bit field writer
1249
1296
  *
1250
- * Note: When returning to a byte read, remaining bits are dropped
1297
+ * Note: When returning to a byte write, remaining bits are dropped
1251
1298
  *
1252
1299
  * @param {number} value - value as int
1253
1300
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1259,7 +1306,7 @@ export class biwriter {
1259
1306
  /**
1260
1307
  * Bit field writer
1261
1308
  *
1262
- * Note: When returning to a byte read, remaining bits are dropped
1309
+ * Note: When returning to a byte write, remaining bits are dropped
1263
1310
  *
1264
1311
  * @param {number} value - value as int
1265
1312
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1272,7 +1319,7 @@ export class biwriter {
1272
1319
  /**
1273
1320
  * Bit field writer
1274
1321
  *
1275
- * Note: When returning to a byte read, remaining bits are dropped
1322
+ * Note: When returning to a byte write, remaining bits are dropped
1276
1323
  *
1277
1324
  * @param {number} value - value as int
1278
1325
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1284,7 +1331,7 @@ export class biwriter {
1284
1331
  /**
1285
1332
  * Bit field writer
1286
1333
  *
1287
- * Note: When returning to a byte read, remaining bits are dropped
1334
+ * Note: When returning to a byte write, remaining bits are dropped
1288
1335
  *
1289
1336
  * @param {number} value - value as int
1290
1337
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1297,7 +1344,7 @@ export class biwriter {
1297
1344
  /**
1298
1345
  * Bit field writer
1299
1346
  *
1300
- * Note: When returning to a byte read, remaining bits are dropped
1347
+ * Note: When returning to a byte write, remaining bits are dropped
1301
1348
  *
1302
1349
  * @param {number} value - value as int
1303
1350
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1309,7 +1356,7 @@ export class biwriter {
1309
1356
  /**
1310
1357
  * Bit field writer
1311
1358
  *
1312
- * Note: When returning to a byte read, remaining bits are dropped
1359
+ * Note: When returning to a byte write, remaining bits are dropped
1313
1360
  *
1314
1361
  * @param {number} value - value as int
1315
1362
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1322,7 +1369,7 @@ export class biwriter {
1322
1369
  /**
1323
1370
  * Bit field writer
1324
1371
  *
1325
- * Note: When returning to a byte read, remaining bits are dropped
1372
+ * Note: When returning to a byte write, remaining bits are dropped
1326
1373
  *
1327
1374
  * @param {number} value - value as int
1328
1375
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1334,7 +1381,7 @@ export class biwriter {
1334
1381
  /**
1335
1382
  * Bit field writer
1336
1383
  *
1337
- * Note: When returning to a byte read, remaining bits are dropped
1384
+ * Note: When returning to a byte write, remaining bits are dropped
1338
1385
  *
1339
1386
  * @param {number} value - value as int
1340
1387
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1347,7 +1394,7 @@ export class biwriter {
1347
1394
  /**
1348
1395
  * Bit field writer
1349
1396
  *
1350
- * Note: When returning to a byte read, remaining bits are dropped
1397
+ * Note: When returning to a byte write, remaining bits are dropped
1351
1398
  *
1352
1399
  * @param {number} value - value as int
1353
1400
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1359,7 +1406,7 @@ export class biwriter {
1359
1406
  /**
1360
1407
  * Bit field writer
1361
1408
  *
1362
- * Note: When returning to a byte read, remaining bits are dropped
1409
+ * Note: When returning to a byte write, remaining bits are dropped
1363
1410
  *
1364
1411
  * @param {number} value - value as int
1365
1412
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1372,7 +1419,7 @@ export class biwriter {
1372
1419
  /**
1373
1420
  * Bit field writer
1374
1421
  *
1375
- * Note: When returning to a byte read, remaining bits are dropped
1422
+ * Note: When returning to a byte write, remaining bits are dropped
1376
1423
  *
1377
1424
  * @param {number} value - value as int
1378
1425
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1384,7 +1431,7 @@ export class biwriter {
1384
1431
  /**
1385
1432
  * Bit field writer
1386
1433
  *
1387
- * Note: When returning to a byte read, remaining bits are dropped
1434
+ * Note: When returning to a byte write, remaining bits are dropped
1388
1435
  *
1389
1436
  * @param {number} value - value as int
1390
1437
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1397,7 +1444,7 @@ export class biwriter {
1397
1444
  /**
1398
1445
  * Bit field writer
1399
1446
  *
1400
- * Note: When returning to a byte read, remaining bits are dropped
1447
+ * Note: When returning to a byte write, remaining bits are dropped
1401
1448
  *
1402
1449
  * @param {number} value - value as int
1403
1450
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1409,7 +1456,7 @@ export class biwriter {
1409
1456
  /**
1410
1457
  * Bit field writer
1411
1458
  *
1412
- * Note: When returning to a byte read, remaining bits are dropped
1459
+ * Note: When returning to a byte write, remaining bits are dropped
1413
1460
  *
1414
1461
  * @param {number} value - value as int
1415
1462
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1422,7 +1469,7 @@ export class biwriter {
1422
1469
  /**
1423
1470
  * Bit field writer
1424
1471
  *
1425
- * Note: When returning to a byte read, remaining bits are dropped
1472
+ * Note: When returning to a byte write, remaining bits are dropped
1426
1473
  *
1427
1474
  * @param {number} value - value as int
1428
1475
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1434,7 +1481,7 @@ export class biwriter {
1434
1481
  /**
1435
1482
  * Bit field writer
1436
1483
  *
1437
- * Note: When returning to a byte read, remaining bits are dropped
1484
+ * Note: When returning to a byte write, remaining bits are dropped
1438
1485
  *
1439
1486
  * @param {number} value - value as int
1440
1487
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1447,7 +1494,7 @@ export class biwriter {
1447
1494
  /**
1448
1495
  * Bit field writer
1449
1496
  *
1450
- * Note: When returning to a byte read, remaining bits are dropped
1497
+ * Note: When returning to a byte write, remaining bits are dropped
1451
1498
  *
1452
1499
  * @param {number} value - value as int
1453
1500
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1459,7 +1506,7 @@ export class biwriter {
1459
1506
  /**
1460
1507
  * Bit field writer
1461
1508
  *
1462
- * Note: When returning to a byte read, remaining bits are dropped
1509
+ * Note: When returning to a byte write, remaining bits are dropped
1463
1510
  *
1464
1511
  * @param {number} value - value as int
1465
1512
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1472,7 +1519,7 @@ export class biwriter {
1472
1519
  /**
1473
1520
  * Bit field writer
1474
1521
  *
1475
- * Note: When returning to a byte read, remaining bits are dropped
1522
+ * Note: When returning to a byte write, remaining bits are dropped
1476
1523
  *
1477
1524
  * @param {number} value - value as int
1478
1525
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1484,7 +1531,7 @@ export class biwriter {
1484
1531
  /**
1485
1532
  * Bit field writer
1486
1533
  *
1487
- * Note: When returning to a byte read, remaining bits are dropped
1534
+ * Note: When returning to a byte write, remaining bits are dropped
1488
1535
  *
1489
1536
  * @param {number} value - value as int
1490
1537
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1497,7 +1544,7 @@ export class biwriter {
1497
1544
  /**
1498
1545
  * Bit field writer
1499
1546
  *
1500
- * Note: When returning to a byte read, remaining bits are dropped
1547
+ * Note: When returning to a byte write, remaining bits are dropped
1501
1548
  *
1502
1549
  * @param {number} value - value as int
1503
1550
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1509,7 +1556,7 @@ export class biwriter {
1509
1556
  /**
1510
1557
  * Bit field writer
1511
1558
  *
1512
- * Note: When returning to a byte read, remaining bits are dropped
1559
+ * Note: When returning to a byte write, remaining bits are dropped
1513
1560
  *
1514
1561
  * @param {number} value - value as int
1515
1562
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1522,7 +1569,7 @@ export class biwriter {
1522
1569
  /**
1523
1570
  * Bit field writer
1524
1571
  *
1525
- * Note: When returning to a byte read, remaining bits are dropped
1572
+ * Note: When returning to a byte write, remaining bits are dropped
1526
1573
  *
1527
1574
  * @param {number} value - value as int
1528
1575
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1534,7 +1581,7 @@ export class biwriter {
1534
1581
  /**
1535
1582
  * Bit field writer
1536
1583
  *
1537
- * Note: When returning to a byte read, remaining bits are dropped
1584
+ * Note: When returning to a byte write, remaining bits are dropped
1538
1585
  *
1539
1586
  * @param {number} value - value as int
1540
1587
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1547,7 +1594,7 @@ export class biwriter {
1547
1594
  /**
1548
1595
  * Bit field writer
1549
1596
  *
1550
- * Note: When returning to a byte read, remaining bits are dropped
1597
+ * Note: When returning to a byte write, remaining bits are dropped
1551
1598
  *
1552
1599
  * @param {number} value - value as int
1553
1600
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1559,7 +1606,7 @@ export class biwriter {
1559
1606
  /**
1560
1607
  * Bit field writer
1561
1608
  *
1562
- * Note: When returning to a byte read, remaining bits are dropped
1609
+ * Note: When returning to a byte write, remaining bits are dropped
1563
1610
  *
1564
1611
  * @param {number} value - value as int
1565
1612
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1572,7 +1619,7 @@ export class biwriter {
1572
1619
  /**
1573
1620
  * Bit field writer
1574
1621
  *
1575
- * Note: When returning to a byte read, remaining bits are dropped
1622
+ * Note: When returning to a byte write, remaining bits are dropped
1576
1623
  *
1577
1624
  * @param {number} value - value as int
1578
1625
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1584,7 +1631,7 @@ export class biwriter {
1584
1631
  /**
1585
1632
  * Bit field writer
1586
1633
  *
1587
- * Note: When returning to a byte read, remaining bits are dropped
1634
+ * Note: When returning to a byte write, remaining bits are dropped
1588
1635
  *
1589
1636
  * @param {number} value - value as int
1590
1637
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1597,7 +1644,7 @@ export class biwriter {
1597
1644
  /**
1598
1645
  * Bit field writer
1599
1646
  *
1600
- * Note: When returning to a byte read, remaining bits are dropped
1647
+ * Note: When returning to a byte write, remaining bits are dropped
1601
1648
  *
1602
1649
  * @param {number} value - value as int
1603
1650
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1609,7 +1656,7 @@ export class biwriter {
1609
1656
  /**
1610
1657
  * Bit field writer
1611
1658
  *
1612
- * Note: When returning to a byte read, remaining bits are dropped
1659
+ * Note: When returning to a byte write, remaining bits are dropped
1613
1660
  *
1614
1661
  * @param {number} value - value as int
1615
1662
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1622,7 +1669,7 @@ export class biwriter {
1622
1669
  /**
1623
1670
  * Bit field writer
1624
1671
  *
1625
- * Note: When returning to a byte read, remaining bits are dropped
1672
+ * Note: When returning to a byte write, remaining bits are dropped
1626
1673
  *
1627
1674
  * @param {number} value - value as int
1628
1675
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1634,7 +1681,7 @@ export class biwriter {
1634
1681
  /**
1635
1682
  * Bit field writer
1636
1683
  *
1637
- * Note: When returning to a byte read, remaining bits are dropped
1684
+ * Note: When returning to a byte write, remaining bits are dropped
1638
1685
  *
1639
1686
  * @param {number} value - value as int
1640
1687
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1647,7 +1694,7 @@ export class biwriter {
1647
1694
  /**
1648
1695
  * Bit field writer
1649
1696
  *
1650
- * Note: When returning to a byte read, remaining bits are dropped
1697
+ * Note: When returning to a byte write, remaining bits are dropped
1651
1698
  *
1652
1699
  * @param {number} value - value as int
1653
1700
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1659,7 +1706,7 @@ export class biwriter {
1659
1706
  /**
1660
1707
  * Bit field writer
1661
1708
  *
1662
- * Note: When returning to a byte read, remaining bits are dropped
1709
+ * Note: When returning to a byte write, remaining bits are dropped
1663
1710
  *
1664
1711
  * @param {number} value - value as int
1665
1712
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1672,7 +1719,7 @@ export class biwriter {
1672
1719
  /**
1673
1720
  * Bit field writer
1674
1721
  *
1675
- * Note: When returning to a byte read, remaining bits are dropped
1722
+ * Note: When returning to a byte write, remaining bits are dropped
1676
1723
  *
1677
1724
  * @param {number} value - value as int
1678
1725
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1684,7 +1731,7 @@ export class biwriter {
1684
1731
  /**
1685
1732
  * Bit field writer
1686
1733
  *
1687
- * Note: When returning to a byte read, remaining bits are dropped
1734
+ * Note: When returning to a byte write, remaining bits are dropped
1688
1735
  *
1689
1736
  * @param {number} value - value as int
1690
1737
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1697,7 +1744,7 @@ export class biwriter {
1697
1744
  /**
1698
1745
  * Bit field writer
1699
1746
  *
1700
- * Note: When returning to a byte read, remaining bits are dropped
1747
+ * Note: When returning to a byte write, remaining bits are dropped
1701
1748
  *
1702
1749
  * @param {number} value - value as int
1703
1750
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1709,7 +1756,7 @@ export class biwriter {
1709
1756
  /**
1710
1757
  * Bit field writer
1711
1758
  *
1712
- * Note: When returning to a byte read, remaining bits are dropped
1759
+ * Note: When returning to a byte write, remaining bits are dropped
1713
1760
  *
1714
1761
  * @param {number} value - value as int
1715
1762
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1722,7 +1769,7 @@ export class biwriter {
1722
1769
  /**
1723
1770
  * Bit field writer
1724
1771
  *
1725
- * Note: When returning to a byte read, remaining bits are dropped
1772
+ * Note: When returning to a byte write, remaining bits are dropped
1726
1773
  *
1727
1774
  * @param {number} value - value as int
1728
1775
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1734,7 +1781,7 @@ export class biwriter {
1734
1781
  /**
1735
1782
  * Bit field writer
1736
1783
  *
1737
- * Note: When returning to a byte read, remaining bits are dropped
1784
+ * Note: When returning to a byte write, remaining bits are dropped
1738
1785
  *
1739
1786
  * @param {number} value - value as int
1740
1787
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1747,7 +1794,7 @@ export class biwriter {
1747
1794
  /**
1748
1795
  * Bit field writer
1749
1796
  *
1750
- * Note: When returning to a byte read, remaining bits are dropped
1797
+ * Note: When returning to a byte write, remaining bits are dropped
1751
1798
  *
1752
1799
  * @param {number} value - value as int
1753
1800
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1759,7 +1806,7 @@ export class biwriter {
1759
1806
  /**
1760
1807
  * Bit field writer
1761
1808
  *
1762
- * Note: When returning to a byte read, remaining bits are dropped
1809
+ * Note: When returning to a byte write, remaining bits are dropped
1763
1810
  *
1764
1811
  * @param {number} value - value as int
1765
1812
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1772,7 +1819,7 @@ export class biwriter {
1772
1819
  /**
1773
1820
  * Bit field writer
1774
1821
  *
1775
- * Note: When returning to a byte read, remaining bits are dropped
1822
+ * Note: When returning to a byte write, remaining bits are dropped
1776
1823
  *
1777
1824
  * @param {number} value - value as int
1778
1825
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1784,7 +1831,7 @@ export class biwriter {
1784
1831
  /**
1785
1832
  * Bit field writer
1786
1833
  *
1787
- * Note: When returning to a byte read, remaining bits are dropped
1834
+ * Note: When returning to a byte write, remaining bits are dropped
1788
1835
  *
1789
1836
  * @param {number} value - value as int
1790
1837
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1797,7 +1844,7 @@ export class biwriter {
1797
1844
  /**
1798
1845
  * Bit field writer
1799
1846
  *
1800
- * Note: When returning to a byte read, remaining bits are dropped
1847
+ * Note: When returning to a byte write, remaining bits are dropped
1801
1848
  *
1802
1849
  * @param {number} value - value as int
1803
1850
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1809,7 +1856,7 @@ export class biwriter {
1809
1856
  /**
1810
1857
  * Bit field writer
1811
1858
  *
1812
- * Note: When returning to a byte read, remaining bits are dropped
1859
+ * Note: When returning to a byte write, remaining bits are dropped
1813
1860
  *
1814
1861
  * @param {number} value - value as int
1815
1862
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1822,7 +1869,7 @@ export class biwriter {
1822
1869
  /**
1823
1870
  * Bit field writer
1824
1871
  *
1825
- * Note: When returning to a byte read, remaining bits are dropped
1872
+ * Note: When returning to a byte write, remaining bits are dropped
1826
1873
  *
1827
1874
  * @param {number} value - value as int
1828
1875
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1834,7 +1881,7 @@ export class biwriter {
1834
1881
  /**
1835
1882
  * Bit field writer
1836
1883
  *
1837
- * Note: When returning to a byte read, remaining bits are dropped
1884
+ * Note: When returning to a byte write, remaining bits are dropped
1838
1885
  *
1839
1886
  * @param {number} value - value as int
1840
1887
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1847,7 +1894,7 @@ export class biwriter {
1847
1894
  /**
1848
1895
  * Bit field writer
1849
1896
  *
1850
- * Note: When returning to a byte read, remaining bits are dropped
1897
+ * Note: When returning to a byte write, remaining bits are dropped
1851
1898
  *
1852
1899
  * @param {number} value - value as int
1853
1900
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1859,7 +1906,7 @@ export class biwriter {
1859
1906
  /**
1860
1907
  * Bit field writer
1861
1908
  *
1862
- * Note: When returning to a byte read, remaining bits are dropped
1909
+ * Note: When returning to a byte write, remaining bits are dropped
1863
1910
  *
1864
1911
  * @param {number} value - value as int
1865
1912
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1872,7 +1919,7 @@ export class biwriter {
1872
1919
  /**
1873
1920
  * Bit field writer
1874
1921
  *
1875
- * Note: When returning to a byte read, remaining bits are dropped
1922
+ * Note: When returning to a byte write, remaining bits are dropped
1876
1923
  *
1877
1924
  * @param {number} value - value as int
1878
1925
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1884,7 +1931,7 @@ export class biwriter {
1884
1931
  /**
1885
1932
  * Bit field writer
1886
1933
  *
1887
- * Note: When returning to a byte read, remaining bits are dropped
1934
+ * Note: When returning to a byte write, remaining bits are dropped
1888
1935
  *
1889
1936
  * @param {number} value - value as int
1890
1937
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1897,7 +1944,7 @@ export class biwriter {
1897
1944
  /**
1898
1945
  * Bit field writer
1899
1946
  *
1900
- * Note: When returning to a byte read, remaining bits are dropped
1947
+ * Note: When returning to a byte write, remaining bits are dropped
1901
1948
  *
1902
1949
  * @param {number} value - value as int
1903
1950
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1909,7 +1956,7 @@ export class biwriter {
1909
1956
  /**
1910
1957
  * Bit field writer
1911
1958
  *
1912
- * Note: When returning to a byte read, remaining bits are dropped
1959
+ * Note: When returning to a byte write, remaining bits are dropped
1913
1960
  *
1914
1961
  * @param {number} value - value as int
1915
1962
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1922,7 +1969,7 @@ export class biwriter {
1922
1969
  /**
1923
1970
  * Bit field writer
1924
1971
  *
1925
- * Note: When returning to a byte read, remaining bits are dropped
1972
+ * Note: When returning to a byte write, remaining bits are dropped
1926
1973
  *
1927
1974
  * @param {number} value - value as int
1928
1975
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1934,7 +1981,7 @@ export class biwriter {
1934
1981
  /**
1935
1982
  * Bit field writer
1936
1983
  *
1937
- * Note: When returning to a byte read, remaining bits are dropped
1984
+ * Note: When returning to a byte write, remaining bits are dropped
1938
1985
  *
1939
1986
  * @param {number} value - value as int
1940
1987
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1947,7 +1994,7 @@ export class biwriter {
1947
1994
  /**
1948
1995
  * Bit field writer
1949
1996
  *
1950
- * Note: When returning to a byte read, remaining bits are dropped
1997
+ * Note: When returning to a byte write, remaining bits are dropped
1951
1998
  *
1952
1999
  * @param {number} value - value as int
1953
2000
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1959,7 +2006,7 @@ export class biwriter {
1959
2006
  /**
1960
2007
  * Bit field writer
1961
2008
  *
1962
- * Note: When returning to a byte read, remaining bits are dropped
2009
+ * Note: When returning to a byte write, remaining bits are dropped
1963
2010
  *
1964
2011
  * @param {number} value - value as int
1965
2012
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1972,7 +2019,7 @@ export class biwriter {
1972
2019
  /**
1973
2020
  * Bit field writer
1974
2021
  *
1975
- * Note: When returning to a byte read, remaining bits are dropped
2022
+ * Note: When returning to a byte write, remaining bits are dropped
1976
2023
  *
1977
2024
  * @param {number} value - value as int
1978
2025
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1984,7 +2031,7 @@ export class biwriter {
1984
2031
  /**
1985
2032
  * Bit field writer
1986
2033
  *
1987
- * Note: When returning to a byte read, remaining bits are dropped
2034
+ * Note: When returning to a byte write, remaining bits are dropped
1988
2035
  *
1989
2036
  * @param {number} value - value as int
1990
2037
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1997,7 +2044,7 @@ export class biwriter {
1997
2044
  /**
1998
2045
  * Bit field writer
1999
2046
  *
2000
- * Note: When returning to a byte read, remaining bits are dropped
2047
+ * Note: When returning to a byte write, remaining bits are dropped
2001
2048
  *
2002
2049
  * @param {number} value - value as int
2003
2050
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2009,7 +2056,7 @@ export class biwriter {
2009
2056
  /**
2010
2057
  * Bit field writer
2011
2058
  *
2012
- * Note: When returning to a byte read, remaining bits are dropped
2059
+ * Note: When returning to a byte write, remaining bits are dropped
2013
2060
  *
2014
2061
  * @param {number} value - value as int
2015
2062
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2022,7 +2069,7 @@ export class biwriter {
2022
2069
  /**
2023
2070
  * Bit field writer
2024
2071
  *
2025
- * Note: When returning to a byte read, remaining bits are dropped
2072
+ * Note: When returning to a byte write, remaining bits are dropped
2026
2073
  *
2027
2074
  * @param {number} value - value as int
2028
2075
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2034,7 +2081,7 @@ export class biwriter {
2034
2081
  /**
2035
2082
  * Bit field writer
2036
2083
  *
2037
- * Note: When returning to a byte read, remaining bits are dropped
2084
+ * Note: When returning to a byte write, remaining bits are dropped
2038
2085
  *
2039
2086
  * @param {number} value - value as int
2040
2087
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2047,7 +2094,7 @@ export class biwriter {
2047
2094
  /**
2048
2095
  * Bit field writer
2049
2096
  *
2050
- * Note: When returning to a byte read, remaining bits are dropped
2097
+ * Note: When returning to a byte write, remaining bits are dropped
2051
2098
  *
2052
2099
  * @param {number} value - value as int
2053
2100
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2059,7 +2106,7 @@ export class biwriter {
2059
2106
  /**
2060
2107
  * Bit field writer
2061
2108
  *
2062
- * Note: When returning to a byte read, remaining bits are dropped
2109
+ * Note: When returning to a byte write, remaining bits are dropped
2063
2110
  *
2064
2111
  * @param {number} value - value as int
2065
2112
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2072,7 +2119,7 @@ export class biwriter {
2072
2119
  /**
2073
2120
  * Bit field writer
2074
2121
  *
2075
- * Note: When returning to a byte read, remaining bits are dropped
2122
+ * Note: When returning to a byte write, remaining bits are dropped
2076
2123
  *
2077
2124
  * @param {number} value - value as int
2078
2125
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2084,7 +2131,7 @@ export class biwriter {
2084
2131
  /**
2085
2132
  * Bit field writer
2086
2133
  *
2087
- * Note: When returning to a byte read, remaining bits are dropped
2134
+ * Note: When returning to a byte write, remaining bits are dropped
2088
2135
  *
2089
2136
  * @param {number} value - value as int
2090
2137
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2097,7 +2144,7 @@ export class biwriter {
2097
2144
  /**
2098
2145
  * Bit field writer
2099
2146
  *
2100
- * Note: When returning to a byte read, remaining bits are dropped
2147
+ * Note: When returning to a byte write, remaining bits are dropped
2101
2148
  *
2102
2149
  * @param {number} value - value as int
2103
2150
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2109,7 +2156,7 @@ export class biwriter {
2109
2156
  /**
2110
2157
  * Bit field writer
2111
2158
  *
2112
- * Note: When returning to a byte read, remaining bits are dropped
2159
+ * Note: When returning to a byte write, remaining bits are dropped
2113
2160
  *
2114
2161
  * @param {number} value - value as int
2115
2162
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2122,7 +2169,7 @@ export class biwriter {
2122
2169
  /**
2123
2170
  * Bit field writer
2124
2171
  *
2125
- * Note: When returning to a byte read, remaining bits are dropped
2172
+ * Note: When returning to a byte write, remaining bits are dropped
2126
2173
  *
2127
2174
  * @param {number} value - value as int
2128
2175
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2134,7 +2181,7 @@ export class biwriter {
2134
2181
  /**
2135
2182
  * Bit field writer
2136
2183
  *
2137
- * Note: When returning to a byte read, remaining bits are dropped
2184
+ * Note: When returning to a byte write, remaining bits are dropped
2138
2185
  *
2139
2186
  * @param {number} value - value as int
2140
2187
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2147,7 +2194,7 @@ export class biwriter {
2147
2194
  /**
2148
2195
  * Bit field writer
2149
2196
  *
2150
- * Note: When returning to a byte read, remaining bits are dropped
2197
+ * Note: When returning to a byte write, remaining bits are dropped
2151
2198
  *
2152
2199
  * @param {number} value - value as int
2153
2200
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2159,7 +2206,7 @@ export class biwriter {
2159
2206
  /**
2160
2207
  * Bit field writer
2161
2208
  *
2162
- * Note: When returning to a byte read, remaining bits are dropped
2209
+ * Note: When returning to a byte write, remaining bits are dropped
2163
2210
  *
2164
2211
  * @param {number} value - value as int
2165
2212
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2172,7 +2219,7 @@ export class biwriter {
2172
2219
  /**
2173
2220
  * Bit field writer
2174
2221
  *
2175
- * Note: When returning to a byte read, remaining bits are dropped
2222
+ * Note: When returning to a byte write, remaining bits are dropped
2176
2223
  *
2177
2224
  * @param {number} value - value as int
2178
2225
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2184,7 +2231,7 @@ export class biwriter {
2184
2231
  /**
2185
2232
  * Bit field writer
2186
2233
  *
2187
- * Note: When returning to a byte read, remaining bits are dropped
2234
+ * Note: When returning to a byte write, remaining bits are dropped
2188
2235
  *
2189
2236
  * @param {number} value - value as int
2190
2237
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2197,7 +2244,7 @@ export class biwriter {
2197
2244
  /**
2198
2245
  * Bit field writer
2199
2246
  *
2200
- * Note: When returning to a byte read, remaining bits are dropped
2247
+ * Note: When returning to a byte write, remaining bits are dropped
2201
2248
  *
2202
2249
  * @param {number} value - value as int
2203
2250
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2209,7 +2256,7 @@ export class biwriter {
2209
2256
  /**
2210
2257
  * Bit field writer
2211
2258
  *
2212
- * Note: When returning to a byte read, remaining bits are dropped
2259
+ * Note: When returning to a byte write, remaining bits are dropped
2213
2260
  *
2214
2261
  * @param {number} value - value as int
2215
2262
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2222,7 +2269,7 @@ export class biwriter {
2222
2269
  /**
2223
2270
  * Bit field writer
2224
2271
  *
2225
- * Note: When returning to a byte read, remaining bits are dropped
2272
+ * Note: When returning to a byte write, remaining bits are dropped
2226
2273
  *
2227
2274
  * @param {number} value - value as int
2228
2275
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2234,7 +2281,7 @@ export class biwriter {
2234
2281
  /**
2235
2282
  * Bit field writer
2236
2283
  *
2237
- * Note: When returning to a byte read, remaining bits are dropped
2284
+ * Note: When returning to a byte write, remaining bits are dropped
2238
2285
  *
2239
2286
  * @param {number} value - value as int
2240
2287
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2247,7 +2294,7 @@ export class biwriter {
2247
2294
  /**
2248
2295
  * Bit field writer
2249
2296
  *
2250
- * Note: When returning to a byte read, remaining bits are dropped
2297
+ * Note: When returning to a byte write, remaining bits are dropped
2251
2298
  *
2252
2299
  * @param {number} value - value as int
2253
2300
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2259,7 +2306,7 @@ export class biwriter {
2259
2306
  /**
2260
2307
  * Bit field writer
2261
2308
  *
2262
- * Note: When returning to a byte read, remaining bits are dropped
2309
+ * Note: When returning to a byte write, remaining bits are dropped
2263
2310
  *
2264
2311
  * @param {number} value - value as int
2265
2312
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2272,7 +2319,7 @@ export class biwriter {
2272
2319
  /**
2273
2320
  * Bit field writer
2274
2321
  *
2275
- * Note: When returning to a byte read, remaining bits are dropped
2322
+ * Note: When returning to a byte write, remaining bits are dropped
2276
2323
  *
2277
2324
  * @param {number} value - value as int
2278
2325
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2284,7 +2331,7 @@ export class biwriter {
2284
2331
  /**
2285
2332
  * Bit field writer
2286
2333
  *
2287
- * Note: When returning to a byte read, remaining bits are dropped
2334
+ * Note: When returning to a byte write, remaining bits are dropped
2288
2335
  *
2289
2336
  * @param {number} value - value as int
2290
2337
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2297,7 +2344,7 @@ export class biwriter {
2297
2344
  /**
2298
2345
  * Bit field writer
2299
2346
  *
2300
- * Note: When returning to a byte read, remaining bits are dropped
2347
+ * Note: When returning to a byte write, remaining bits are dropped
2301
2348
  *
2302
2349
  * @param {number} value - value as int
2303
2350
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2309,7 +2356,7 @@ export class biwriter {
2309
2356
  /**
2310
2357
  * Bit field writer
2311
2358
  *
2312
- * Note: When returning to a byte read, remaining bits are dropped
2359
+ * Note: When returning to a byte write, remaining bits are dropped
2313
2360
  *
2314
2361
  * @param {number} value - value as int
2315
2362
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2322,7 +2369,7 @@ export class biwriter {
2322
2369
  /**
2323
2370
  * Bit field writer
2324
2371
  *
2325
- * Note: When returning to a byte read, remaining bits are dropped
2372
+ * Note: When returning to a byte write, remaining bits are dropped
2326
2373
  *
2327
2374
  * @param {number} value - value as int
2328
2375
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2334,7 +2381,7 @@ export class biwriter {
2334
2381
  /**
2335
2382
  * Bit field writer
2336
2383
  *
2337
- * Note: When returning to a byte read, remaining bits are dropped
2384
+ * Note: When returning to a byte write, remaining bits are dropped
2338
2385
  *
2339
2386
  * @param {number} value - value as int
2340
2387
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2347,7 +2394,7 @@ export class biwriter {
2347
2394
  /**
2348
2395
  * Bit field writer
2349
2396
  *
2350
- * Note: When returning to a byte read, remaining bits are dropped
2397
+ * Note: When returning to a byte write, remaining bits are dropped
2351
2398
  *
2352
2399
  * @param {number} value - value as int
2353
2400
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2359,7 +2406,7 @@ export class biwriter {
2359
2406
  /**
2360
2407
  * Bit field writer
2361
2408
  *
2362
- * Note: When returning to a byte read, remaining bits are dropped
2409
+ * Note: When returning to a byte write, remaining bits are dropped
2363
2410
  *
2364
2411
  * @param {number} value - value as int
2365
2412
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2372,7 +2419,7 @@ export class biwriter {
2372
2419
  /**
2373
2420
  * Bit field writer
2374
2421
  *
2375
- * Note: When returning to a byte read, remaining bits are dropped
2422
+ * Note: When returning to a byte write, remaining bits are dropped
2376
2423
  *
2377
2424
  * @param {number} value - value as int
2378
2425
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2384,7 +2431,7 @@ export class biwriter {
2384
2431
  /**
2385
2432
  * Bit field writer
2386
2433
  *
2387
- * Note: When returning to a byte read, remaining bits are dropped
2434
+ * Note: When returning to a byte write, remaining bits are dropped
2388
2435
  *
2389
2436
  * @param {number} value - value as int
2390
2437
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2397,7 +2444,7 @@ export class biwriter {
2397
2444
  /**
2398
2445
  * Bit field writer
2399
2446
  *
2400
- * Note: When returning to a byte read, remaining bits are dropped
2447
+ * Note: When returning to a byte write, remaining bits are dropped
2401
2448
  *
2402
2449
  * @param {number} value - value as int
2403
2450
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2409,7 +2456,7 @@ export class biwriter {
2409
2456
  /**
2410
2457
  * Bit field writer
2411
2458
  *
2412
- * Note: When returning to a byte read, remaining bits are dropped
2459
+ * Note: When returning to a byte write, remaining bits are dropped
2413
2460
  *
2414
2461
  * @param {number} value - value as int
2415
2462
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2422,7 +2469,7 @@ export class biwriter {
2422
2469
  /**
2423
2470
  * Bit field writer
2424
2471
  *
2425
- * Note: When returning to a byte read, remaining bits are dropped
2472
+ * Note: When returning to a byte write, remaining bits are dropped
2426
2473
  *
2427
2474
  * @param {number} value - value as int
2428
2475
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2434,7 +2481,7 @@ export class biwriter {
2434
2481
  /**
2435
2482
  * Bit field writer
2436
2483
  *
2437
- * Note: When returning to a byte read, remaining bits are dropped
2484
+ * Note: When returning to a byte write, remaining bits are dropped
2438
2485
  *
2439
2486
  * @param {number} value - value as int
2440
2487
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2447,7 +2494,7 @@ export class biwriter {
2447
2494
  /**
2448
2495
  * Bit field writer
2449
2496
  *
2450
- * Note: When returning to a byte read, remaining bits are dropped
2497
+ * Note: When returning to a byte write, remaining bits are dropped
2451
2498
  *
2452
2499
  * @param {number} value - value as int
2453
2500
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2459,7 +2506,7 @@ export class biwriter {
2459
2506
  /**
2460
2507
  * Bit field writer
2461
2508
  *
2462
- * Note: When returning to a byte read, remaining bits are dropped
2509
+ * Note: When returning to a byte write, remaining bits are dropped
2463
2510
  *
2464
2511
  * @param {number} value - value as int
2465
2512
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2472,7 +2519,7 @@ export class biwriter {
2472
2519
  /**
2473
2520
  * Bit field writer
2474
2521
  *
2475
- * Note: When returning to a byte read, remaining bits are dropped
2522
+ * Note: When returning to a byte write, remaining bits are dropped
2476
2523
  *
2477
2524
  * @param {number} value - value as int
2478
2525
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2484,7 +2531,7 @@ export class biwriter {
2484
2531
  /**
2485
2532
  * Bit field writer
2486
2533
  *
2487
- * Note: When returning to a byte read, remaining bits are dropped
2534
+ * Note: When returning to a byte write, remaining bits are dropped
2488
2535
  *
2489
2536
  * @param {number} value - value as int
2490
2537
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2497,7 +2544,7 @@ export class biwriter {
2497
2544
  /**
2498
2545
  * Bit field writer
2499
2546
  *
2500
- * Note: When returning to a byte read, remaining bits are dropped
2547
+ * Note: When returning to a byte write, remaining bits are dropped
2501
2548
  *
2502
2549
  * @param {number} value - value as int
2503
2550
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2509,7 +2556,7 @@ export class biwriter {
2509
2556
  /**
2510
2557
  * Bit field writer
2511
2558
  *
2512
- * Note: When returning to a byte read, remaining bits are dropped
2559
+ * Note: When returning to a byte write, remaining bits are dropped
2513
2560
  *
2514
2561
  * @param {number} value - value as int
2515
2562
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2522,7 +2569,7 @@ export class biwriter {
2522
2569
  /**
2523
2570
  * Bit field writer
2524
2571
  *
2525
- * Note: When returning to a byte read, remaining bits are dropped
2572
+ * Note: When returning to a byte write, remaining bits are dropped
2526
2573
  *
2527
2574
  * @param {number} value - value as int
2528
2575
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2534,7 +2581,7 @@ export class biwriter {
2534
2581
  /**
2535
2582
  * Bit field writer
2536
2583
  *
2537
- * Note: When returning to a byte read, remaining bits are dropped
2584
+ * Note: When returning to a byte write, remaining bits are dropped
2538
2585
  *
2539
2586
  * @param {number} value - value as int
2540
2587
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2547,7 +2594,7 @@ export class biwriter {
2547
2594
  /**
2548
2595
  * Bit field writer
2549
2596
  *
2550
- * Note: When returning to a byte read, remaining bits are dropped
2597
+ * Note: When returning to a byte write, remaining bits are dropped
2551
2598
  *
2552
2599
  * @param {number} value - value as int
2553
2600
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2559,7 +2606,7 @@ export class biwriter {
2559
2606
  /**
2560
2607
  * Bit field writer
2561
2608
  *
2562
- * Note: When returning to a byte read, remaining bits are dropped
2609
+ * Note: When returning to a byte write, remaining bits are dropped
2563
2610
  *
2564
2611
  * @param {number} value - value as int
2565
2612
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2572,7 +2619,7 @@ export class biwriter {
2572
2619
  /**
2573
2620
  * Bit field writer
2574
2621
  *
2575
- * Note: When returning to a byte read, remaining bits are dropped
2622
+ * Note: When returning to a byte write, remaining bits are dropped
2576
2623
  *
2577
2624
  * @param {number} value - value as int
2578
2625
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2584,7 +2631,7 @@ export class biwriter {
2584
2631
  /**
2585
2632
  * Bit field writer
2586
2633
  *
2587
- * Note: When returning to a byte read, remaining bits are dropped
2634
+ * Note: When returning to a byte write, remaining bits are dropped
2588
2635
  *
2589
2636
  * @param {number} value - value as int
2590
2637
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2597,7 +2644,7 @@ export class biwriter {
2597
2644
  /**
2598
2645
  * Bit field writer
2599
2646
  *
2600
- * Note: When returning to a byte read, remaining bits are dropped
2647
+ * Note: When returning to a byte write, remaining bits are dropped
2601
2648
  *
2602
2649
  * @param {number} value - value as int
2603
2650
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2609,7 +2656,7 @@ export class biwriter {
2609
2656
  /**
2610
2657
  * Bit field writer
2611
2658
  *
2612
- * Note: When returning to a byte read, remaining bits are dropped
2659
+ * Note: When returning to a byte write, remaining bits are dropped
2613
2660
  *
2614
2661
  * @param {number} value - value as int
2615
2662
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2622,7 +2669,7 @@ export class biwriter {
2622
2669
  /**
2623
2670
  * Bit field writer
2624
2671
  *
2625
- * Note: When returning to a byte read, remaining bits are dropped
2672
+ * Note: When returning to a byte write, remaining bits are dropped
2626
2673
  *
2627
2674
  * @param {number} value - value as int
2628
2675
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2634,7 +2681,7 @@ export class biwriter {
2634
2681
  /**
2635
2682
  * Bit field writer
2636
2683
  *
2637
- * Note: When returning to a byte read, remaining bits are dropped
2684
+ * Note: When returning to a byte write, remaining bits are dropped
2638
2685
  *
2639
2686
  * @param {number} value - value as int
2640
2687
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2647,7 +2694,7 @@ export class biwriter {
2647
2694
  /**
2648
2695
  * Bit field writer
2649
2696
  *
2650
- * Note: When returning to a byte read, remaining bits are dropped
2697
+ * Note: When returning to a byte write, remaining bits are dropped
2651
2698
  *
2652
2699
  * @param {number} value - value as int
2653
2700
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2659,7 +2706,7 @@ export class biwriter {
2659
2706
  /**
2660
2707
  * Bit field writer
2661
2708
  *
2662
- * Note: When returning to a byte read, remaining bits are dropped
2709
+ * Note: When returning to a byte write, remaining bits are dropped
2663
2710
  *
2664
2711
  * @param {number} value - value as int
2665
2712
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2672,7 +2719,7 @@ export class biwriter {
2672
2719
  /**
2673
2720
  * Bit field writer
2674
2721
  *
2675
- * Note: When returning to a byte read, remaining bits are dropped
2722
+ * Note: When returning to a byte write, remaining bits are dropped
2676
2723
  *
2677
2724
  * @param {number} value - value as int
2678
2725
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2684,7 +2731,7 @@ export class biwriter {
2684
2731
  /**
2685
2732
  * Bit field writer
2686
2733
  *
2687
- * Note: When returning to a byte read, remaining bits are dropped
2734
+ * Note: When returning to a byte write, remaining bits are dropped
2688
2735
  *
2689
2736
  * @param {number} value - value as int
2690
2737
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2697,7 +2744,7 @@ export class biwriter {
2697
2744
  /**
2698
2745
  * Bit field writer
2699
2746
  *
2700
- * Note: When returning to a byte read, remaining bits are dropped
2747
+ * Note: When returning to a byte write, remaining bits are dropped
2701
2748
  *
2702
2749
  * @param {number} value - value as int
2703
2750
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2709,7 +2756,7 @@ export class biwriter {
2709
2756
  /**
2710
2757
  * Bit field writer
2711
2758
  *
2712
- * Note: When returning to a byte read, remaining bits are dropped
2759
+ * Note: When returning to a byte write, remaining bits are dropped
2713
2760
  *
2714
2761
  * @param {number} value - value as int
2715
2762
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2722,7 +2769,7 @@ export class biwriter {
2722
2769
  /**
2723
2770
  * Bit field writer
2724
2771
  *
2725
- * Note: When returning to a byte read, remaining bits are dropped
2772
+ * Note: When returning to a byte write, remaining bits are dropped
2726
2773
  *
2727
2774
  * @param {number} value - value as int
2728
2775
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2734,7 +2781,7 @@ export class biwriter {
2734
2781
  /**
2735
2782
  * Bit field writer
2736
2783
  *
2737
- * Note: When returning to a byte read, remaining bits are dropped
2784
+ * Note: When returning to a byte write, remaining bits are dropped
2738
2785
  *
2739
2786
  * @param {number} value - value as int
2740
2787
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2747,7 +2794,7 @@ export class biwriter {
2747
2794
  /**
2748
2795
  * Bit field writer
2749
2796
  *
2750
- * Note: When returning to a byte read, remaining bits are dropped
2797
+ * Note: When returning to a byte write, remaining bits are dropped
2751
2798
  *
2752
2799
  * @param {number} value - value as int
2753
2800
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2759,7 +2806,7 @@ export class biwriter {
2759
2806
  /**
2760
2807
  * Bit field writer
2761
2808
  *
2762
- * Note: When returning to a byte read, remaining bits are dropped
2809
+ * Note: When returning to a byte write, remaining bits are dropped
2763
2810
  *
2764
2811
  * @param {number} value - value as int
2765
2812
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2772,7 +2819,7 @@ export class biwriter {
2772
2819
  /**
2773
2820
  * Bit field writer
2774
2821
  *
2775
- * Note: When returning to a byte read, remaining bits are dropped
2822
+ * Note: When returning to a byte write, remaining bits are dropped
2776
2823
  *
2777
2824
  * @param {number} value - value as int
2778
2825
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2784,7 +2831,7 @@ export class biwriter {
2784
2831
  /**
2785
2832
  * Bit field writer
2786
2833
  *
2787
- * Note: When returning to a byte read, remaining bits are dropped
2834
+ * Note: When returning to a byte write, remaining bits are dropped
2788
2835
  *
2789
2836
  * @param {number} value - value as int
2790
2837
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2797,7 +2844,7 @@ export class biwriter {
2797
2844
  /**
2798
2845
  * Bit field writer
2799
2846
  *
2800
- * Note: When returning to a byte read, remaining bits are dropped
2847
+ * Note: When returning to a byte write, remaining bits are dropped
2801
2848
  *
2802
2849
  * @param {number} value - value as int
2803
2850
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2809,7 +2856,7 @@ export class biwriter {
2809
2856
  /**
2810
2857
  * Bit field writer
2811
2858
  *
2812
- * Note: When returning to a byte read, remaining bits are dropped
2859
+ * Note: When returning to a byte write, remaining bits are dropped
2813
2860
  *
2814
2861
  * @param {number} value - value as int
2815
2862
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2822,7 +2869,7 @@ export class biwriter {
2822
2869
  /**
2823
2870
  * Bit field writer
2824
2871
  *
2825
- * Note: When returning to a byte read, remaining bits are dropped
2872
+ * Note: When returning to a byte write, remaining bits are dropped
2826
2873
  *
2827
2874
  * @param {number} value - value as int
2828
2875
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2834,7 +2881,7 @@ export class biwriter {
2834
2881
  /**
2835
2882
  * Bit field writer
2836
2883
  *
2837
- * Note: When returning to a byte read, remaining bits are dropped
2884
+ * Note: When returning to a byte write, remaining bits are dropped
2838
2885
  *
2839
2886
  * @param {number} value - value as int
2840
2887
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2847,7 +2894,7 @@ export class biwriter {
2847
2894
  /**
2848
2895
  * Bit field writer
2849
2896
  *
2850
- * Note: When returning to a byte read, remaining bits are dropped
2897
+ * Note: When returning to a byte write, remaining bits are dropped
2851
2898
  *
2852
2899
  * @param {number} value - value as int
2853
2900
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2859,7 +2906,7 @@ export class biwriter {
2859
2906
  /**
2860
2907
  * Bit field writer
2861
2908
  *
2862
- * Note: When returning to a byte read, remaining bits are dropped
2909
+ * Note: When returning to a byte write, remaining bits are dropped
2863
2910
  *
2864
2911
  * @param {number} value - value as int
2865
2912
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2872,7 +2919,7 @@ export class biwriter {
2872
2919
  /**
2873
2920
  * Bit field writer
2874
2921
  *
2875
- * Note: When returning to a byte read, remaining bits are dropped
2922
+ * Note: When returning to a byte write, remaining bits are dropped
2876
2923
  *
2877
2924
  * @param {number} value - value as int
2878
2925
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2884,7 +2931,7 @@ export class biwriter {
2884
2931
  /**
2885
2932
  * Bit field writer
2886
2933
  *
2887
- * Note: When returning to a byte read, remaining bits are dropped
2934
+ * Note: When returning to a byte write, remaining bits are dropped
2888
2935
  *
2889
2936
  * @param {number} value - value as int
2890
2937
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2897,7 +2944,7 @@ export class biwriter {
2897
2944
  /**
2898
2945
  * Bit field writer
2899
2946
  *
2900
- * Note: When returning to a byte read, remaining bits are dropped
2947
+ * Note: When returning to a byte write, remaining bits are dropped
2901
2948
  *
2902
2949
  * @param {number} value - value as int
2903
2950
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2909,7 +2956,7 @@ export class biwriter {
2909
2956
  /**
2910
2957
  * Bit field writer
2911
2958
  *
2912
- * Note: When returning to a byte read, remaining bits are dropped
2959
+ * Note: When returning to a byte write, remaining bits are dropped
2913
2960
  *
2914
2961
  * @param {number} value - value as int
2915
2962
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2922,7 +2969,7 @@ export class biwriter {
2922
2969
  /**
2923
2970
  * Bit field writer
2924
2971
  *
2925
- * Note: When returning to a byte read, remaining bits are dropped
2972
+ * Note: When returning to a byte write, remaining bits are dropped
2926
2973
  *
2927
2974
  * @param {number} value - value as int
2928
2975
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2934,7 +2981,7 @@ export class biwriter {
2934
2981
  /**
2935
2982
  * Bit field writer
2936
2983
  *
2937
- * Note: When returning to a byte read, remaining bits are dropped
2984
+ * Note: When returning to a byte write, remaining bits are dropped
2938
2985
  *
2939
2986
  * @param {number} value - value as int
2940
2987
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2947,7 +2994,7 @@ export class biwriter {
2947
2994
  /**
2948
2995
  * Bit field writer
2949
2996
  *
2950
- * Note: When returning to a byte read, remaining bits are dropped
2997
+ * Note: When returning to a byte write, remaining bits are dropped
2951
2998
  *
2952
2999
  * @param {number} value - value as int
2953
3000
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2959,7 +3006,7 @@ export class biwriter {
2959
3006
  /**
2960
3007
  * Bit field writer
2961
3008
  *
2962
- * Note: When returning to a byte read, remaining bits are dropped
3009
+ * Note: When returning to a byte write, remaining bits are dropped
2963
3010
  *
2964
3011
  * @param {number} value - value as int
2965
3012
  * @param {number} bits - number of bits to write
@@ -2973,7 +3020,7 @@ export class biwriter {
2973
3020
  /**
2974
3021
  * Bit field writer
2975
3022
  *
2976
- * Note: When returning to a byte read, remaining bits are dropped
3023
+ * Note: When returning to a byte write, remaining bits are dropped
2977
3024
  *
2978
3025
  * @param {number} value - value as int
2979
3026
  * @param {number} bits - number of bits to write
@@ -2987,7 +3034,7 @@ export class biwriter {
2987
3034
  /**
2988
3035
  * Bit field writer
2989
3036
  *
2990
- * Note: When returning to a byte read, remaining bits are dropped
3037
+ * Note: When returning to a byte write, remaining bits are dropped
2991
3038
  *
2992
3039
  * @param {number} value - value as int
2993
3040
  * @param {number} bits - number of bits to write
@@ -3001,7 +3048,7 @@ export class biwriter {
3001
3048
  /**
3002
3049
  * Bit field writer
3003
3050
  *
3004
- * Note: When returning to a byte read, remaining bits are dropped
3051
+ * Note: When returning to a byte write, remaining bits are dropped
3005
3052
  *
3006
3053
  * @param {number} value - value as int
3007
3054
  * @param {number} bits - number of bits to write
@@ -3026,6 +3073,7 @@ export class biwriter {
3026
3073
  this.check_size(1, 0, offset);
3027
3074
  if (unsigned == true) {
3028
3075
  if (value < 0 || value > 255) {
3076
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3029
3077
  throw new Error('Value is out of range for the specified 8bit length.' + " min: " + 0 + " max: " + 255 + " value: " + value);
3030
3078
  }
3031
3079
  }
@@ -3033,6 +3081,7 @@ export class biwriter {
3033
3081
  const maxValue = Math.pow(2, 8 - 1) - 1;
3034
3082
  const minValue = -maxValue - 1;
3035
3083
  if (value < minValue || value > maxValue) {
3084
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3036
3085
  throw new Error('Value is out of range for the specified 8bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3037
3086
  }
3038
3087
  }
@@ -3101,6 +3150,7 @@ export class biwriter {
3101
3150
  this.check_size(2, 0, offset);
3102
3151
  if (unsigned == true) {
3103
3152
  if (value < 0 || value > 65535) {
3153
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3104
3154
  throw new Error('Value is out of range for the specified 16bit length.' + " min: " + 0 + " max: " + 65535 + " value: " + value);
3105
3155
  }
3106
3156
  }
@@ -3108,6 +3158,7 @@ export class biwriter {
3108
3158
  const maxValue = Math.pow(2, 16 - 1) - 1;
3109
3159
  const minValue = -maxValue - 1;
3110
3160
  if (value < minValue || value > maxValue) {
3161
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3111
3162
  throw new Error('Value is out of range for the specified 16bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3112
3163
  }
3113
3164
  }
@@ -3353,6 +3404,7 @@ export class biwriter {
3353
3404
  const maxValue = 65504;
3354
3405
  const minValue = 5.96e-08;
3355
3406
  if (value < minValue || value > maxValue) {
3407
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3356
3408
  throw new Error('Value is out of range for the specified half float length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3357
3409
  }
3358
3410
  const signMask = 0x8000;
@@ -3478,6 +3530,7 @@ export class biwriter {
3478
3530
  this.check_size(4, 0, offset);
3479
3531
  if (unsigned == true) {
3480
3532
  if (value < 0 || value > 4294967295) {
3533
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3481
3534
  throw new Error('Value is out of range for the specified 32bit length.' + " min: " + 0 + " max: " + 4294967295 + " value: " + value);
3482
3535
  }
3483
3536
  }
@@ -3485,6 +3538,7 @@ export class biwriter {
3485
3538
  const maxValue = Math.pow(2, 32 - 1) - 1;
3486
3539
  const minValue = -maxValue - 1;
3487
3540
  if (value < minValue || value > maxValue) {
3541
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3488
3542
  throw new Error('Value is out of range for the specified 32bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3489
3543
  }
3490
3544
  }
@@ -3791,6 +3845,7 @@ export class biwriter {
3791
3845
  const maxValue = 3.402823466e+38;
3792
3846
  const minValue = 1.175494351e-38;
3793
3847
  if (value < minValue || value > maxValue) {
3848
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3794
3849
  throw new Error('Value is out of range for the specified float length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3795
3850
  }
3796
3851
  let intValue = Float32Array.from([value])[0]; // Convert float to 32-bit integer representation
@@ -3867,6 +3922,7 @@ export class biwriter {
3867
3922
  this.check_size(8, 0, offset);
3868
3923
  if (unsigned == true) {
3869
3924
  if (value < 0 || value > Math.pow(2, 64) - 1) {
3925
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3870
3926
  throw new Error('Value is out of range for the specified 64bit length.' + " min: " + 0 + " max: " + (Math.pow(2, 64) - 1) + " value: " + value);
3871
3927
  }
3872
3928
  }
@@ -3874,6 +3930,7 @@ export class biwriter {
3874
3930
  const maxValue = Math.pow(2, 63) - 1;
3875
3931
  const minValue = -Math.pow(2, 63);
3876
3932
  if (value < minValue || value > maxValue) {
3933
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
3877
3934
  throw new Error('Value is out of range for the specified 64bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
3878
3935
  }
3879
3936
  }
@@ -4132,7 +4189,7 @@ export class biwriter {
4132
4189
  return this.writeInt64(value, offset, true, "big");
4133
4190
  }
4134
4191
  //
4135
- //doublefloat reader
4192
+ //doublefloat
4136
4193
  //
4137
4194
  /**
4138
4195
  * Writes double float
@@ -4146,6 +4203,7 @@ export class biwriter {
4146
4203
  const maxValue = 1.7976931348623158e308;
4147
4204
  const minValue = 2.2250738585072014e-308;
4148
4205
  if (value < minValue || value > maxValue) {
4206
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4149
4207
  throw new Error('Value is out of range for the specified 64bit length.' + " min: " + minValue + " max: " + maxValue + " value: " + value);
4150
4208
  }
4151
4209
  const intArray = new Int32Array(2);
@@ -4336,9 +4394,11 @@ export class biwriter {
4336
4394
  maxLength = 4294967295;
4337
4395
  }
4338
4396
  else {
4339
- throw new Error("Invalid length read size: " + lengthWriteSize);
4397
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4398
+ throw new Error("Invalid length write size: " + lengthWriteSize);
4340
4399
  }
4341
4400
  if (string.length > maxLength || (length || 0) > maxLength) {
4401
+ this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4342
4402
  throw new Error("String outsize of max write length: " + maxLength);
4343
4403
  }
4344
4404
  var maxBytes = Math.min(string.length, maxLength);
@@ -4377,7 +4437,7 @@ export class biwriter {
4377
4437
  this.offset += totalLength;
4378
4438
  }
4379
4439
  else {
4380
- throw new Error('Unsupported string type.');
4440
+ throw new Error('Unsupported string type: ' + stringType);
4381
4441
  }
4382
4442
  }
4383
4443
  /**