bireader 1.0.14 → 1.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,14 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.biwriter = void 0;
4
+ const common_1 = require("./common");
4
5
  /**
5
6
  * Binary writer, includes bitfields and strings
6
7
  *
7
8
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
8
- * @param {number} byteOffset - byte offset to start writer, default is 0
9
- * @param {number} bitOffset - bit offset to start writer, 0-7
10
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
11
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
9
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
10
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
11
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
12
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
12
13
  */
13
14
  class biwriter {
14
15
  isBuffer(obj) {
@@ -21,44 +22,25 @@ class biwriter {
21
22
  if ((typeof Buffer !== 'undefined' && this.data instanceof Buffer)) {
22
23
  var paddbuffer = Buffer.alloc(to_padd);
23
24
  this.data = Buffer.concat([this.data, paddbuffer]);
25
+ this.size = this.data.length;
24
26
  }
25
27
  else {
26
28
  const addArray = new Array(to_padd);
27
29
  this.data = new Uint8Array([...this.data, ...addArray]);
30
+ this.size = this.data.length;
28
31
  }
29
32
  }
30
33
  check_size(write_bytes, write_bit, offset) {
31
- const bits = (write_bit || 0) + this.bitoffset;
32
- var new_off = (offset || this.offset);
33
- var writesize = write_bytes || 0;
34
- if (bits != 0) {
35
- //add bits
36
- writesize += Math.ceil(bits / 8);
37
- }
38
- //if biger extend
39
- const needed_size = new_off + writesize;
40
- if (needed_size > this.size) {
41
- const dif = needed_size - this.size;
42
- if (this.strict == false) {
43
- this.extendArray(dif);
44
- }
45
- else {
46
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
47
- throw new Error(`Reader reached end of data: reading to ` + needed_size + " at " + this.offset + " of " + this.size);
48
- }
49
- this.size = this.data.length;
50
- }
51
- //start read location
52
- this.offset = new_off;
34
+ return (0, common_1.checkSize)(this, write_bytes || 0, write_bit || 0, offset || this.offset);
53
35
  }
54
36
  /**
55
37
  * Binary writer, includes bitfields and strings
56
38
  *
57
39
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
58
- * @param {number} byteOffset - byte offset to start writer, default is 0
59
- * @param {number} bitOffset - bit offset to start writer, 0-7
60
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
61
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
40
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
41
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
42
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
43
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
62
44
  */
63
45
  constructor(data, byteOffset, bitOffset, endianness, strict) {
64
46
  this.endian = "little";
@@ -98,7 +80,7 @@ class biwriter {
98
80
  throw new Error("Data required");
99
81
  }
100
82
  else {
101
- if (!this.isBufferOrUint8Array(this.data)) {
83
+ if (!this.isBufferOrUint8Array(data)) {
102
84
  throw new Error("Write data must be Uint8Array or Buffer");
103
85
  }
104
86
  }
@@ -106,8 +88,7 @@ class biwriter {
106
88
  this.size = this.data.length + ((bitOffset || 0) % 8);
107
89
  }
108
90
  /**
109
- *
110
- * Change endian, defaults to little
91
+ * Change endian (default little)
111
92
  *
112
93
  * Can be changed at any time, doesn't loose position
113
94
  *
@@ -123,170 +104,133 @@ class biwriter {
123
104
  this.endian = endian;
124
105
  }
125
106
  /**
126
- *
127
107
  * Sets endian to big
108
+ *
128
109
  */
129
110
  bigEndian() {
130
111
  this.endianness("big");
131
112
  }
132
113
  /**
133
- *
134
114
  * Sets endian to big
115
+ *
135
116
  */
136
117
  big() {
137
118
  this.endianness("big");
138
119
  }
139
120
  /**
140
- *
141
121
  * Sets endian to big
122
+ *
142
123
  */
143
124
  be() {
144
125
  this.endianness("big");
145
126
  }
146
127
  /**
147
- *
148
128
  * Sets endian to little
129
+ *
149
130
  */
150
131
  littleEndian() {
151
132
  this.endianness("little");
152
133
  }
153
134
  /**
154
- *
155
135
  * Sets endian to little
136
+ *
156
137
  */
157
138
  little() {
158
139
  this.endianness("little");
159
140
  }
160
141
  /**
161
- *
162
142
  * Sets endian to little
143
+ *
163
144
  */
164
145
  le() {
165
146
  this.endianness("little");
166
147
  }
148
+ //
149
+ // move from current position
150
+ //
167
151
  /**
168
- * Move current write byte or bit position, will extend data if outside of current size
152
+ * Offset current byte or bit position
153
+ * Note: Will extend array if strict mode is off and outside of max size
169
154
  *
170
- * @param {number} bytes - bytes to skip
171
- * @param {number} bits - bits to skip (0-7)
155
+ * @param {number} bytes - Bytes to skip
156
+ * @param {number} bits - Bits to skip (0-7)
172
157
  */
173
158
  skip(bytes, bits) {
174
- this.check_size(bytes, bits);
175
- this.offset += (bytes || 0);
176
- this.bitoffset += (bits || 0) % 8;
159
+ return (0, common_1.skip)(this, bytes, bits);
177
160
  }
178
161
  /**
179
- * Move current write byte or bit position, will extend data if outside of current size
162
+ * Offset current byte or bit position
163
+ * Note: Will extend array if strict mode is off and outside of max size
180
164
  *
181
- * @param {number} bytes - bytes to skip
182
- * @param {number} bits - bits to skip (0-7)
165
+ * @param {number} bytes - Bytes to skip
166
+ * @param {number} bits - Bits to skip (0-7)
183
167
  */
184
- fskip(bytes, bits) {
185
- this.check_size(bytes, bits);
186
- this.offset += (bytes || 0);
187
- this.bitoffset += (bits || 0) % 8;
168
+ jump(bytes, bits) {
169
+ this.skip(bytes, bits);
188
170
  }
171
+ //
172
+ // directly set current position
173
+ //
189
174
  /**
190
- * Change current byte or bit write position, will extend data if outside of current size
175
+ * Change position directly to address
176
+ * Note: Will extend array if strict mode is off and outside of max size
191
177
  *
192
- * @param {number} byte - byte to jump to
193
- * @param {number} bit - bit to jump to (0-7)
178
+ * @param {number} byte - byte to set to
179
+ * @param {number} bit - bit to set to (0-7)
194
180
  */
195
181
  goto(byte, bit) {
196
- const new_size = (byte + Math.ceil((bit || 0) / 8));
197
- if (new_size > this.size && this.strict == false) {
198
- this.extendArray(new_size - this.size);
199
- }
200
- else {
201
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
202
- throw new Error("Outside of range of data: goto " + new_size + " of " + this.size);
203
- }
204
- this.offset = byte;
205
- this.bitoffset = (bit || 0) % 8;
182
+ return (0, common_1.goto)(this, byte, bit);
206
183
  }
207
184
  /**
208
- * Change current byte or bit write position, will extend data if outside of current size
185
+ * Change position directly to address
186
+ * Note: Will extend array if strict mode is off and outside of max size
209
187
  *
210
- * @param {number} byte - byte to jump to
211
- * @param {number} bit - bit to jump to (0-7)
188
+ * @param {number} byte - byte to set to
189
+ * @param {number} bit - bit to set to (0-7)
212
190
  */
213
191
  seek(byte, bit) {
214
192
  return this.goto(byte, bit);
215
193
  }
216
194
  /**
217
- * Change current byte or bit write position, will extend data if outside of current size
218
- *
219
- * @param {number} byte - byte to jump to
220
- * @param {number} bit - bit to jump to (0-7)
221
- */
222
- fseek(byte, bit) {
223
- return this.goto(byte, bit);
224
- }
225
- /**
226
- * Change current byte or bit write position, will extend data if outside of current size
195
+ * Change position directly to address
196
+ * Note: Will extend array if strict mode is off and outside of max size
227
197
  *
228
- * @param {number} byte - byte to jump to
229
- * @param {number} bit - bit to jump to (0-7)
230
- */
231
- jump(byte, bit) {
232
- return this.goto(byte, bit);
233
- }
234
- /**
235
- * Change current byte or bit write position, will extend data if outside of current size
236
- *
237
- * @param {number} byte - byte to jump to
238
- * @param {number} bit - bit to jump to (0-7)
198
+ * @param {number} byte - byte to set to
199
+ * @param {number} bit - bit to set to (0-7)
239
200
  */
240
201
  pointer(byte, bit) {
241
202
  return this.goto(byte, bit);
242
203
  }
243
204
  /**
244
- * Change current byte or bit write position, will extend data if outside of current size
205
+ * Change position directly to address
206
+ * Note: Will extend array if strict mode is off and outside of max size
245
207
  *
246
- * @param {number} byte - byte to jump to
247
- * @param {number} bit - bit to jump to (0-7)
208
+ * @param {number} byte - byte to set to
209
+ * @param {number} bit - bit to set to (0-7)
248
210
  */
249
211
  warp(byte, bit) {
250
212
  return this.goto(byte, bit);
251
213
  }
214
+ //
215
+ //go to start
216
+ //
252
217
  /**
253
- * Change current byte or bit write position, will extend data if outside of current size
254
- *
255
- * @param {number} byte - byte to jump to
256
- * @param {number} bit - bit to jump to (0-7)
257
- */
258
- fsetpos(byte, bit) {
259
- return this.goto(byte, bit);
260
- }
261
- /**
262
- * Set offset to start of file
218
+ * Set byte and bit position to start of data
263
219
  */
264
220
  rewind() {
265
221
  this.offset = 0;
266
222
  this.bitoffset = 0;
267
223
  }
268
224
  /**
269
- * Set offset to start of file
225
+ * Set byte and bit position to start of data
270
226
  */
271
227
  gotostart() {
272
228
  this.offset = 0;
273
229
  this.bitoffset = 0;
274
230
  }
275
- /**
276
- * Set offset to start of file
277
- */
278
- tostart() {
279
- this.offset = 0;
280
- this.bitoffset = 0;
281
- }
282
- /**
283
- * Get the current byte position
284
- *
285
- * @return {number} current byte position
286
- */
287
- ftell() {
288
- return this.offset;
289
- }
231
+ //
232
+ //get position
233
+ //
290
234
  /**
291
235
  * Get the current byte position
292
236
  *
@@ -300,7 +244,7 @@ class biwriter {
300
244
  *
301
245
  * @return {number} current byte position
302
246
  */
303
- fgetpos() {
247
+ getOffset() {
304
248
  return this.offset;
305
249
  }
306
250
  /**
@@ -311,143 +255,201 @@ class biwriter {
311
255
  saveOffset() {
312
256
  return this.offset;
313
257
  }
258
+ //
259
+ //strict mode change
260
+ //
314
261
  /**
315
- * Disallows extending array if writing outside of max size
262
+ * Disallows extending data if position is outside of max size
316
263
  */
317
264
  restrict() {
318
265
  this.strict = true;
319
266
  }
320
267
  /**
321
- * Allows extending array if writing outside of max size
268
+ * Allows extending data if position is outside of max size
322
269
  */
323
270
  unrestrict() {
324
271
  this.strict = false;
325
272
  }
273
+ //
274
+ //remove part of data
275
+ //
326
276
  /**
327
- * Truncates array from start to current position unless supplied
328
- * Note: Does not affect supplied data
329
- * Note: Will extend array if strict mode is off
330
- * @param {number} startOffset - Start location, default 0
331
- * @param {number} endOffset - end location, default current write position
332
- */
333
- clip(startOffset, endOffset) {
334
- if ((endOffset || this.offset) > this.size) {
335
- if (this.strict == false) {
336
- this.extendArray((endOffset || this.offset) - this.size);
337
- }
338
- else {
339
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
340
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
341
- }
342
- }
343
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
277
+ * Deletes part of data from start to current byte position unless supplied, returns removed
278
+ * Note: Errors in strict mode
279
+ *
280
+ * @param {number} startOffset - Start location (default 0)
281
+ * @param {number} endOffset - End location (default current position)
282
+ * @param {boolean} consume - Move position to end of removed data (default false)
283
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
284
+ */
285
+ delete(startOffset, endOffset, consume) {
286
+ return (0, common_1.remove)(this, startOffset || 0, endOffset || this.offset, consume || false, true);
344
287
  }
345
288
  /**
346
- * Truncates array from start to current position unless supplied
347
- * Note: Does not affect supplied data
348
- * Note: Will extend array if strict mode is off
349
- * @param {number} startOffset - Start location, default 0
350
- * @param {number} endOffset - end location, default current write position
351
- */
352
- crop(startOffset, endOffset) {
353
- if ((endOffset || this.offset) > this.size) {
354
- if (this.strict == false) {
355
- this.extendArray((endOffset || this.offset) - this.size);
356
- }
357
- else {
358
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
359
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
360
- }
361
- }
362
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
289
+ * Deletes part of data from start to current byte position unless supplied, returns removed
290
+ * Note: Errors in strict mode
291
+ *
292
+ * @param {number} startOffset - Start location (default 0)
293
+ * @param {number} endOffset - End location (default current position)
294
+ * @param {boolean} consume - Move position to end of removed data (default false)
295
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
296
+ */
297
+ clip(startOffset, endOffset, consume) {
298
+ return (0, common_1.remove)(this, startOffset || 0, endOffset || this.offset, consume || false, true);
363
299
  }
364
300
  /**
365
- * Truncates array from start to current position unless supplied
366
- * Note: Does not affect supplied data
367
- * Note: Will extend array if strict mode is off
368
- * @param {number} startOffset - Start location, default 0
369
- * @param {number} endOffset - end location, default current write position
370
- */
371
- truncate(startOffset, endOffset) {
372
- if ((endOffset || this.offset) > this.size) {
373
- if (this.strict == false) {
374
- this.extendArray((endOffset || this.offset) - this.size);
375
- }
376
- else {
377
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
378
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
379
- }
380
- }
381
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
301
+ * Deletes part of data from current byte position to supplied length, returns removed
302
+ * Note: Errors in strict mode
303
+ *
304
+ * @param {number} length - Length of data in bytes to remove
305
+ * @param {boolean} consume - Move position to end of removed data (default false)
306
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
307
+ */
308
+ crop(length, consume) {
309
+ return (0, common_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, true);
382
310
  }
383
311
  /**
384
- * Truncates array from start to current position unless supplied
385
- * Note: Does not affect supplied data
386
- * Note: Will extend array if strict mode is off
387
- * @param {number} startOffset - Start location, default 0
388
- * @param {number} endOffset - end location, default current write position
389
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
312
+ * Deletes part of data from current position to supplied length, returns removed
313
+ * Note: Only works in strict mode
314
+ *
315
+ * @param {number} length - Length of data in bytes to remove
316
+ * @param {boolean} consume - Move position to end of removed data (default false)
317
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
390
318
  */
391
- slice(startOffset, endOffset) {
392
- if ((endOffset || this.offset) > this.size) {
393
- if (this.strict == false) {
394
- this.extendArray((endOffset || this.offset) - this.size);
395
- }
396
- else {
397
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
398
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
399
- }
400
- }
401
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
319
+ drop(length, consume) {
320
+ return (0, common_1.remove)(this, this.offset, this.offset + (length || 0), consume || false, true);
321
+ }
322
+ //
323
+ //copy out
324
+ //
325
+ /**
326
+ * Returns part of data from current byte position to end of data unless supplied
327
+ *
328
+ * @param {number} startOffset - Start location (default current position)
329
+ * @param {number} endOffset - End location (default end of data)
330
+ * @param {boolean} consume - Move position to end of lifted data (default false)
331
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
332
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
333
+ */
334
+ lift(startOffset, endOffset, consume, fillValue) {
335
+ return (0, common_1.remove)(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
336
+ }
337
+ /**
338
+ * Returns part of data from current byte position to end of data unless supplied
339
+ *
340
+ * @param {number} startOffset - Start location (default current position)
341
+ * @param {number} endOffset - End location (default end of data)
342
+ * @param {boolean} consume - Move position to end of lifted data (default false)
343
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
344
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
345
+ */
346
+ fill(startOffset, endOffset, consume, fillValue) {
347
+ return (0, common_1.remove)(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
402
348
  }
403
349
  /**
404
- * Extract array from current position to length supplied
350
+ * Extract data from current position to length supplied
405
351
  * Note: Does not affect supplied data
406
- * Note: Will extend array if strict mode is off
407
- * @param {number} length - length of data to copy from current offset
408
- * @param {number} consume - moves offset to end of length
409
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
352
+ *
353
+ * @param {number} length - Length of data in bytes to copy from current offset
354
+ * @param {number} consume - Moves offset to end of length
355
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
410
356
  */
411
357
  extract(length, consume) {
412
- if (this.offset + (length || 0) > this.size) {
413
- if (this.strict == false) {
414
- this.extendArray(this.offset + (length || 0) - this.size);
415
- }
416
- else {
417
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
418
- throw new Error("End offset outside of data: at " + this.offset + " reading " + length + " of" + this.size);
419
- }
420
- }
421
- const extract = this.data.slice(this.offset, this.offset + (length || 0));
422
- if (consume) {
423
- this.offset += length;
424
- }
425
- return extract;
358
+ return (0, common_1.remove)(this, this.offset, length || 0, consume || false, false);
426
359
  }
427
360
  /**
428
- * Extract array from current position to length supplied
361
+ * Extract data from current position to length supplied
429
362
  * Note: Does not affect supplied data
430
- * Note: Will extend array if strict mode is off
431
- * @param {number} length - length of data to copy from current offset
432
- * @param {number} consume - moves offset to end of length
433
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
363
+ *
364
+ * @param {number} length - Length of data in bytes to copy from current offset
365
+ * @param {number} consume - Moves offset to end of length
366
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
434
367
  */
435
- wrap(length, consume) {
436
- return this.extract(length, consume);
368
+ slice(length, consume) {
369
+ return (0, common_1.remove)(this, this.offset, length || 0, consume || false, false);
437
370
  }
438
371
  /**
439
- * Extract array from current position to length supplied
372
+ * Extract data from current position to length supplied
440
373
  * Note: Does not affect supplied data
441
- * Note: Will extend array if strict mode is off
442
- * @param {number} length - length of data to copy from current offset
443
- * @param {number} consume - moves offset to end of length
444
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
374
+ *
375
+ * @param {number} length - Length of data in bytes to copy from current offset
376
+ * @param {number} consume - Moves offset to end of length
377
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
378
+ */
379
+ wrap(length, consume) {
380
+ return (0, common_1.remove)(this, this.offset, length || 0, consume || false, false);
381
+ }
382
+ //
383
+ //insert
384
+ //
385
+ /**
386
+ * Inserts data into data
387
+ * Note: Must be same data type as supplied data. Errors on strict mode.
388
+ *
389
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
390
+ * @param {boolean} consume - Move current write position to end of data (default false)
391
+ * @param {number} offset - Offset to add it at (defaults to current position)
392
+ */
393
+ insert(data, consume, offset) {
394
+ return (0, common_1.addData)(this, data, consume || false, offset || this.offset);
395
+ }
396
+ /**
397
+ * Inserts data into data
398
+ * Note: Must be same data type as supplied data. Errors on strict mode.
399
+ *
400
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
401
+ * @param {boolean} consume - Move current write position to end of data (default false)
402
+ * @param {number} offset - Offset to add it at (defaults to current position)
403
+ */
404
+ place(data, consume, offset) {
405
+ return (0, common_1.addData)(this, data, consume || false, offset || this.offset);
406
+ }
407
+ /**
408
+ * Adds data to start of supplied data
409
+ * Note: Must be same data type as supplied data. Errors on strict mode.
410
+ *
411
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
412
+ * @param {boolean} consume - Move current write position to end of data (default false)
413
+ */
414
+ unshift(data, consume) {
415
+ return (0, common_1.addData)(this, data, consume || false, 0);
416
+ }
417
+ /**
418
+ * Adds data to start of supplied data
419
+ * Note: Must be same data type as supplied data. Errors on strict mode.
420
+ *
421
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
422
+ * @param {boolean} consume - Move current write position to end of data (default false)
423
+ */
424
+ prepend(data, consume) {
425
+ return (0, common_1.addData)(this, data, consume || false, 0);
426
+ }
427
+ /**
428
+ * Adds data to end of supplied data
429
+ * Note: Must be same data type as supplied data. Errors on strict mode.
430
+ *
431
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
432
+ * @param {boolean} consume - Move current write position to end of data (default false)
433
+ */
434
+ push(data, consume) {
435
+ return (0, common_1.addData)(this, data, consume || false, this.size);
436
+ }
437
+ /**
438
+ * Adds data to end of supplied data
439
+ * Note: Must be same data type as supplied data. Errors on strict mode.
440
+ *
441
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
442
+ * @param {boolean} consume - Move current write position to end of data (default false)
445
443
  */
446
- lift(length, consume) {
447
- return this.extract(length, consume);
444
+ append(data, consume) {
445
+ return (0, common_1.addData)(this, data, consume || false, this.size);
448
446
  }
447
+ //
448
+ //finishing
449
+ //
449
450
  /**
450
451
  * Returns current data
452
+ *
451
453
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
452
454
  */
453
455
  get() {
@@ -455,48 +457,37 @@ class biwriter {
455
457
  }
456
458
  /**
457
459
  * Returns current data
460
+ *
458
461
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
459
462
  */
460
463
  return() {
461
464
  return this.data;
462
465
  }
463
466
  /**
464
- * removes writing data
467
+ * removes data
465
468
  */
466
469
  end() {
467
470
  this.data = undefined;
468
471
  }
469
472
  /**
470
- * removes writing data
473
+ * removes data
471
474
  */
472
475
  close() {
473
476
  this.data = undefined;
474
477
  }
475
478
  /**
476
- * removes writing data
479
+ * removes data
477
480
  */
478
481
  done() {
479
482
  this.data = undefined;
480
483
  }
481
484
  /**
482
- * removes writing data
485
+ * removes data
483
486
  */
484
487
  finished() {
485
488
  this.data = undefined;
486
489
  }
487
490
  /**
488
- * Turn hexdump on error off, default on
489
- */
490
- errorDumpOff() {
491
- this.errorDump = false;
492
- }
493
- /**
494
- * Turn hexdump on error on, default on
495
- */
496
- errorDumpOn() {
497
- this.errorDump = true;
498
- }
499
- /**
500
491
  * Console logs data as hex dump
501
492
  *
502
493
  * @param {object} options - options object
@@ -509,186 +500,19 @@ class biwriter {
509
500
  * ```
510
501
  */
511
502
  hexdump(options) {
512
- var length = options && options.length;
513
- var startByte = options && options.startByte;
514
- var supressUnicode = options && options.supressUnicode || false;
515
- if ((startByte || 0) > this.size) {
516
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
517
- throw new Error("Hexdump start is outside of data size: " + startByte + " of " + this.size);
518
- }
519
- const start = startByte || this.offset;
520
- const end = Math.min(start + (length || 192), this.size);
521
- if (start + (length || 0) > this.size) {
522
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
523
- throw new Error("Hexdump amount is outside of data size: " + (start + (length || 0)) + " of " + end);
524
- }
525
- function hex_check(byte, bits) {
526
- var value = 0;
527
- for (var i = 0; i < bits;) {
528
- var remaining = bits - i;
529
- var bitOffset = 0;
530
- var currentByte = byte;
531
- var read = Math.min(remaining, 8 - bitOffset);
532
- var mask, readBits;
533
- mask = ~(0xFF << read);
534
- readBits = (currentByte >> (8 - read - bitOffset)) & mask;
535
- value <<= read;
536
- value |= readBits;
537
- i += read;
538
- }
539
- value = value >>> 0;
540
- return value;
541
- }
542
- const rows = [];
543
- var header = " 0 1 2 3 4 5 6 7 8 9 A B C D E F ";
544
- var ending = "0123456789ABCDEF";
545
- var addr = "";
546
- for (let i = start; i < end; i += 16) {
547
- addr = i.toString(16).padStart(5, '0');
548
- var row = this.data?.slice(i, i + 16) || [];
549
- var hex = Array.from(row, (byte) => byte.toString(16).padStart(2, '0')).join(' ');
550
- rows.push(`${addr} ${hex.padEnd(47)} `);
551
- }
552
- let result = '';
553
- let make_wide = false;
554
- let i = start;
555
- while (i < end) {
556
- const byte = this.data[i];
557
- if (byte < 32 || byte == 127) {
558
- result += '.';
559
- }
560
- else if (byte < 127) {
561
- // Valid UTF-8 start byte or single-byte character
562
- // Convert the byte to a character and add it to the result
563
- result += String.fromCharCode(byte);
564
- }
565
- else if (supressUnicode) {
566
- result += '.';
567
- }
568
- else if (hex_check(byte, 1) == 0) {
569
- //Byte 1
570
- result += String.fromCharCode(byte);
571
- }
572
- else if (hex_check(byte, 3) == 6) {
573
- //Byte 2
574
- if (i + 1 <= end) {
575
- //check second byte
576
- const byte2 = this.data[i + 1];
577
- if (hex_check(byte2, 2) == 2) {
578
- const charCode = ((byte & 0x1f) << 6) | (byte2 & 0x3f);
579
- i++;
580
- make_wide = true;
581
- const read = " " + String.fromCharCode(charCode);
582
- result += read;
583
- }
584
- else {
585
- result += ".";
586
- }
587
- }
588
- else {
589
- result += ".";
590
- }
591
- }
592
- else if (hex_check(byte, 4) == 14) {
593
- //Byte 3
594
- if (i + 1 <= end) {
595
- //check second byte
596
- const byte2 = this.data[i + 1];
597
- if (hex_check(byte2, 2) == 2) {
598
- if (i + 2 <= end) {
599
- //check third byte
600
- const byte3 = this.data[i + 2];
601
- if (hex_check(byte3, 2) == 2) {
602
- const charCode = ((byte & 0x0f) << 12) |
603
- ((byte2 & 0x3f) << 6) |
604
- (byte3 & 0x3f);
605
- i += 2;
606
- make_wide = true;
607
- const read = " " + String.fromCharCode(charCode);
608
- result += read;
609
- }
610
- else {
611
- i++;
612
- result += " .";
613
- }
614
- }
615
- else {
616
- i++;
617
- result += " .";
618
- }
619
- }
620
- else {
621
- result += ".";
622
- }
623
- }
624
- else {
625
- result += ".";
626
- }
627
- }
628
- else if (hex_check(byte, 5) == 28) {
629
- //Byte 4
630
- if (i + 1 <= end) {
631
- //check second byte
632
- const byte2 = this.data[i + 1];
633
- if (hex_check(byte2, 2) == 2) {
634
- if (i + 2 <= end) {
635
- //check third byte
636
- const byte3 = this.data[i + 2];
637
- if (hex_check(byte3, 2) == 2) {
638
- if (i + 3 <= end) {
639
- //check fourth byte
640
- const byte4 = this.data[i + 2];
641
- if (hex_check(byte4, 2) == 2) {
642
- const charCode = (((byte4 & 0xFF) << 24) | ((byte3 & 0xFF) << 16) | ((byte2 & 0xFF) << 8) | (byte & 0xFF));
643
- i += 3;
644
- make_wide = true;
645
- const read = " " + String.fromCharCode(charCode);
646
- result += read;
647
- }
648
- else {
649
- i += 2;
650
- result += " .";
651
- }
652
- }
653
- else {
654
- i += 2;
655
- result += " .";
656
- }
657
- }
658
- else {
659
- i++;
660
- result += " .";
661
- }
662
- }
663
- else {
664
- i++;
665
- result += " .";
666
- }
667
- }
668
- else {
669
- result += ".";
670
- }
671
- }
672
- else {
673
- result += ".";
674
- }
675
- }
676
- else {
677
- // Invalid UTF-8 byte, add a period to the result
678
- result += '.';
679
- }
680
- i++;
681
- }
682
- const chunks = result.match(new RegExp(`.{1,${16}}`, 'g'));
683
- chunks?.forEach((self, i) => {
684
- rows[i] = rows[i] + (make_wide ? "|" + self + "|" : self);
685
- });
686
- header = "".padStart(addr.length) + header + (make_wide ? "" : ending);
687
- rows.unshift(header);
688
- if (make_wide) {
689
- rows.push("*Removed character byte header on unicode detection");
690
- }
691
- console.log(rows.join("\n"));
503
+ return (0, common_1.hexDump)(this, options);
504
+ }
505
+ /**
506
+ * Turn hexdump on error off (default on)
507
+ */
508
+ errorDumpOff() {
509
+ this.errorDump = false;
510
+ }
511
+ /**
512
+ * Turn hexdump on error on (default on)
513
+ */
514
+ errorDumpOn() {
515
+ this.errorDump = true;
692
516
  }
693
517
  //
694
518
  //bit writer
@@ -783,22 +607,22 @@ class biwriter {
783
607
  return this.writeBit(value, bits, offsetBits, offsetBytes, unsigned, endian);
784
608
  }
785
609
  /**
786
- * Bit field writer
787
- *
788
- * Note: When returning to a byte read, remaining bits are dropped
789
- *
790
- * @param {number} value - value as int
791
- * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
792
- * @param {number} offsetBytes - byte offset to start the write (default last write position)
793
- * @param {boolean} unsigned - if value is unsigned or not
794
- */
610
+ * Bit field writer
611
+ *
612
+ * Note: When returning to a byte write, remaining bits are dropped
613
+ *
614
+ * @param {number} value - value as int
615
+ * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
616
+ * @param {number} offsetBytes - byte offset to start the write (default last write position)
617
+ * @param {boolean} unsigned - if value is unsigned or not
618
+ */
795
619
  bit1(value, offsetBits, offsetBytes, unsigned) {
796
620
  return this.bit(value, 1, offsetBits, offsetBytes, unsigned);
797
621
  }
798
622
  /**
799
623
  * Bit field writer
800
624
  *
801
- * Note: When returning to a byte read, remaining bits are dropped
625
+ * Note: When returning to a byte write, remaining bits are dropped
802
626
  *
803
627
  * @param {number} value - value as int
804
628
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -810,7 +634,7 @@ class biwriter {
810
634
  /**
811
635
  * Bit field writer
812
636
  *
813
- * Note: When returning to a byte read, remaining bits are dropped
637
+ * Note: When returning to a byte write, remaining bits are dropped
814
638
  *
815
639
  * @param {number} value - value as int
816
640
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -823,7 +647,7 @@ class biwriter {
823
647
  /**
824
648
  * Bit field writer
825
649
  *
826
- * Note: When returning to a byte read, remaining bits are dropped
650
+ * Note: When returning to a byte write, remaining bits are dropped
827
651
  *
828
652
  * @param {number} value - value as int
829
653
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -835,7 +659,7 @@ class biwriter {
835
659
  /**
836
660
  * Bit field writer
837
661
  *
838
- * Note: When returning to a byte read, remaining bits are dropped
662
+ * Note: When returning to a byte write, remaining bits are dropped
839
663
  *
840
664
  * @param {number} value - value as int
841
665
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -848,7 +672,7 @@ class biwriter {
848
672
  /**
849
673
  * Bit field writer
850
674
  *
851
- * Note: When returning to a byte read, remaining bits are dropped
675
+ * Note: When returning to a byte write, remaining bits are dropped
852
676
  *
853
677
  * @param {number} value - value as int
854
678
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -860,7 +684,7 @@ class biwriter {
860
684
  /**
861
685
  * Bit field writer
862
686
  *
863
- * Note: When returning to a byte read, remaining bits are dropped
687
+ * Note: When returning to a byte write, remaining bits are dropped
864
688
  *
865
689
  * @param {number} value - value as int
866
690
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -873,7 +697,7 @@ class biwriter {
873
697
  /**
874
698
  * Bit field writer
875
699
  *
876
- * Note: When returning to a byte read, remaining bits are dropped
700
+ * Note: When returning to a byte write, remaining bits are dropped
877
701
  *
878
702
  * @param {number} value - value as int
879
703
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -885,7 +709,7 @@ class biwriter {
885
709
  /**
886
710
  * Bit field writer
887
711
  *
888
- * Note: When returning to a byte read, remaining bits are dropped
712
+ * Note: When returning to a byte write, remaining bits are dropped
889
713
  *
890
714
  * @param {number} value - value as int
891
715
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -898,7 +722,7 @@ class biwriter {
898
722
  /**
899
723
  * Bit field writer
900
724
  *
901
- * Note: When returning to a byte read, remaining bits are dropped
725
+ * Note: When returning to a byte write, remaining bits are dropped
902
726
  *
903
727
  * @param {number} value - value as int
904
728
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -910,7 +734,7 @@ class biwriter {
910
734
  /**
911
735
  * Bit field writer
912
736
  *
913
- * Note: When returning to a byte read, remaining bits are dropped
737
+ * Note: When returning to a byte write, remaining bits are dropped
914
738
  *
915
739
  * @param {number} value - value as int
916
740
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -923,7 +747,7 @@ class biwriter {
923
747
  /**
924
748
  * Bit field writer
925
749
  *
926
- * Note: When returning to a byte read, remaining bits are dropped
750
+ * Note: When returning to a byte write, remaining bits are dropped
927
751
  *
928
752
  * @param {number} value - value as int
929
753
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -935,7 +759,7 @@ class biwriter {
935
759
  /**
936
760
  * Bit field writer
937
761
  *
938
- * Note: When returning to a byte read, remaining bits are dropped
762
+ * Note: When returning to a byte write, remaining bits are dropped
939
763
  *
940
764
  * @param {number} value - value as int
941
765
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -948,7 +772,7 @@ class biwriter {
948
772
  /**
949
773
  * Bit field writer
950
774
  *
951
- * Note: When returning to a byte read, remaining bits are dropped
775
+ * Note: When returning to a byte write, remaining bits are dropped
952
776
  *
953
777
  * @param {number} value - value as int
954
778
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -960,7 +784,7 @@ class biwriter {
960
784
  /**
961
785
  * Bit field writer
962
786
  *
963
- * Note: When returning to a byte read, remaining bits are dropped
787
+ * Note: When returning to a byte write, remaining bits are dropped
964
788
  *
965
789
  * @param {number} value - value as int
966
790
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -973,7 +797,7 @@ class biwriter {
973
797
  /**
974
798
  * Bit field writer
975
799
  *
976
- * Note: When returning to a byte read, remaining bits are dropped
800
+ * Note: When returning to a byte write, remaining bits are dropped
977
801
  *
978
802
  * @param {number} value - value as int
979
803
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -985,7 +809,7 @@ class biwriter {
985
809
  /**
986
810
  * Bit field writer
987
811
  *
988
- * Note: When returning to a byte read, remaining bits are dropped
812
+ * Note: When returning to a byte write, remaining bits are dropped
989
813
  *
990
814
  * @param {number} value - value as int
991
815
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -998,7 +822,7 @@ class biwriter {
998
822
  /**
999
823
  * Bit field writer
1000
824
  *
1001
- * Note: When returning to a byte read, remaining bits are dropped
825
+ * Note: When returning to a byte write, remaining bits are dropped
1002
826
  *
1003
827
  * @param {number} value - value as int
1004
828
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1010,7 +834,7 @@ class biwriter {
1010
834
  /**
1011
835
  * Bit field writer
1012
836
  *
1013
- * Note: When returning to a byte read, remaining bits are dropped
837
+ * Note: When returning to a byte write, remaining bits are dropped
1014
838
  *
1015
839
  * @param {number} value - value as int
1016
840
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1023,7 +847,7 @@ class biwriter {
1023
847
  /**
1024
848
  * Bit field writer
1025
849
  *
1026
- * Note: When returning to a byte read, remaining bits are dropped
850
+ * Note: When returning to a byte write, remaining bits are dropped
1027
851
  *
1028
852
  * @param {number} value - value as int
1029
853
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1035,7 +859,7 @@ class biwriter {
1035
859
  /**
1036
860
  * Bit field writer
1037
861
  *
1038
- * Note: When returning to a byte read, remaining bits are dropped
862
+ * Note: When returning to a byte write, remaining bits are dropped
1039
863
  *
1040
864
  * @param {number} value - value as int
1041
865
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1048,7 +872,7 @@ class biwriter {
1048
872
  /**
1049
873
  * Bit field writer
1050
874
  *
1051
- * Note: When returning to a byte read, remaining bits are dropped
875
+ * Note: When returning to a byte write, remaining bits are dropped
1052
876
  *
1053
877
  * @param {number} value - value as int
1054
878
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1060,7 +884,7 @@ class biwriter {
1060
884
  /**
1061
885
  * Bit field writer
1062
886
  *
1063
- * Note: When returning to a byte read, remaining bits are dropped
887
+ * Note: When returning to a byte write, remaining bits are dropped
1064
888
  *
1065
889
  * @param {number} value - value as int
1066
890
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1073,7 +897,7 @@ class biwriter {
1073
897
  /**
1074
898
  * Bit field writer
1075
899
  *
1076
- * Note: When returning to a byte read, remaining bits are dropped
900
+ * Note: When returning to a byte write, remaining bits are dropped
1077
901
  *
1078
902
  * @param {number} value - value as int
1079
903
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1085,7 +909,7 @@ class biwriter {
1085
909
  /**
1086
910
  * Bit field writer
1087
911
  *
1088
- * Note: When returning to a byte read, remaining bits are dropped
912
+ * Note: When returning to a byte write, remaining bits are dropped
1089
913
  *
1090
914
  * @param {number} value - value as int
1091
915
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1098,7 +922,7 @@ class biwriter {
1098
922
  /**
1099
923
  * Bit field writer
1100
924
  *
1101
- * Note: When returning to a byte read, remaining bits are dropped
925
+ * Note: When returning to a byte write, remaining bits are dropped
1102
926
  *
1103
927
  * @param {number} value - value as int
1104
928
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1110,7 +934,7 @@ class biwriter {
1110
934
  /**
1111
935
  * Bit field writer
1112
936
  *
1113
- * Note: When returning to a byte read, remaining bits are dropped
937
+ * Note: When returning to a byte write, remaining bits are dropped
1114
938
  *
1115
939
  * @param {number} value - value as int
1116
940
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1123,7 +947,7 @@ class biwriter {
1123
947
  /**
1124
948
  * Bit field writer
1125
949
  *
1126
- * Note: When returning to a byte read, remaining bits are dropped
950
+ * Note: When returning to a byte write, remaining bits are dropped
1127
951
  *
1128
952
  * @param {number} value - value as int
1129
953
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1135,7 +959,7 @@ class biwriter {
1135
959
  /**
1136
960
  * Bit field writer
1137
961
  *
1138
- * Note: When returning to a byte read, remaining bits are dropped
962
+ * Note: When returning to a byte write, remaining bits are dropped
1139
963
  *
1140
964
  * @param {number} value - value as int
1141
965
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1148,7 +972,7 @@ class biwriter {
1148
972
  /**
1149
973
  * Bit field writer
1150
974
  *
1151
- * Note: When returning to a byte read, remaining bits are dropped
975
+ * Note: When returning to a byte write, remaining bits are dropped
1152
976
  *
1153
977
  * @param {number} value - value as int
1154
978
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1160,7 +984,7 @@ class biwriter {
1160
984
  /**
1161
985
  * Bit field writer
1162
986
  *
1163
- * Note: When returning to a byte read, remaining bits are dropped
987
+ * Note: When returning to a byte write, remaining bits are dropped
1164
988
  *
1165
989
  * @param {number} value - value as int
1166
990
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1173,7 +997,7 @@ class biwriter {
1173
997
  /**
1174
998
  * Bit field writer
1175
999
  *
1176
- * Note: When returning to a byte read, remaining bits are dropped
1000
+ * Note: When returning to a byte write, remaining bits are dropped
1177
1001
  *
1178
1002
  * @param {number} value - value as int
1179
1003
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1185,7 +1009,7 @@ class biwriter {
1185
1009
  /**
1186
1010
  * Bit field writer
1187
1011
  *
1188
- * Note: When returning to a byte read, remaining bits are dropped
1012
+ * Note: When returning to a byte write, remaining bits are dropped
1189
1013
  *
1190
1014
  * @param {number} value - value as int
1191
1015
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1198,7 +1022,7 @@ class biwriter {
1198
1022
  /**
1199
1023
  * Bit field writer
1200
1024
  *
1201
- * Note: When returning to a byte read, remaining bits are dropped
1025
+ * Note: When returning to a byte write, remaining bits are dropped
1202
1026
  *
1203
1027
  * @param {number} value - value as int
1204
1028
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1210,7 +1034,7 @@ class biwriter {
1210
1034
  /**
1211
1035
  * Bit field writer
1212
1036
  *
1213
- * Note: When returning to a byte read, remaining bits are dropped
1037
+ * Note: When returning to a byte write, remaining bits are dropped
1214
1038
  *
1215
1039
  * @param {number} value - value as int
1216
1040
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1223,7 +1047,7 @@ class biwriter {
1223
1047
  /**
1224
1048
  * Bit field writer
1225
1049
  *
1226
- * Note: When returning to a byte read, remaining bits are dropped
1050
+ * Note: When returning to a byte write, remaining bits are dropped
1227
1051
  *
1228
1052
  * @param {number} value - value as int
1229
1053
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1235,7 +1059,7 @@ class biwriter {
1235
1059
  /**
1236
1060
  * Bit field writer
1237
1061
  *
1238
- * Note: When returning to a byte read, remaining bits are dropped
1062
+ * Note: When returning to a byte write, remaining bits are dropped
1239
1063
  *
1240
1064
  * @param {number} value - value as int
1241
1065
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1248,7 +1072,7 @@ class biwriter {
1248
1072
  /**
1249
1073
  * Bit field writer
1250
1074
  *
1251
- * Note: When returning to a byte read, remaining bits are dropped
1075
+ * Note: When returning to a byte write, remaining bits are dropped
1252
1076
  *
1253
1077
  * @param {number} value - value as int
1254
1078
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1260,7 +1084,7 @@ class biwriter {
1260
1084
  /**
1261
1085
  * Bit field writer
1262
1086
  *
1263
- * Note: When returning to a byte read, remaining bits are dropped
1087
+ * Note: When returning to a byte write, remaining bits are dropped
1264
1088
  *
1265
1089
  * @param {number} value - value as int
1266
1090
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1273,7 +1097,7 @@ class biwriter {
1273
1097
  /**
1274
1098
  * Bit field writer
1275
1099
  *
1276
- * Note: When returning to a byte read, remaining bits are dropped
1100
+ * Note: When returning to a byte write, remaining bits are dropped
1277
1101
  *
1278
1102
  * @param {number} value - value as int
1279
1103
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1285,7 +1109,7 @@ class biwriter {
1285
1109
  /**
1286
1110
  * Bit field writer
1287
1111
  *
1288
- * Note: When returning to a byte read, remaining bits are dropped
1112
+ * Note: When returning to a byte write, remaining bits are dropped
1289
1113
  *
1290
1114
  * @param {number} value - value as int
1291
1115
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1298,7 +1122,7 @@ class biwriter {
1298
1122
  /**
1299
1123
  * Bit field writer
1300
1124
  *
1301
- * Note: When returning to a byte read, remaining bits are dropped
1125
+ * Note: When returning to a byte write, remaining bits are dropped
1302
1126
  *
1303
1127
  * @param {number} value - value as int
1304
1128
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1310,7 +1134,7 @@ class biwriter {
1310
1134
  /**
1311
1135
  * Bit field writer
1312
1136
  *
1313
- * Note: When returning to a byte read, remaining bits are dropped
1137
+ * Note: When returning to a byte write, remaining bits are dropped
1314
1138
  *
1315
1139
  * @param {number} value - value as int
1316
1140
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1323,7 +1147,7 @@ class biwriter {
1323
1147
  /**
1324
1148
  * Bit field writer
1325
1149
  *
1326
- * Note: When returning to a byte read, remaining bits are dropped
1150
+ * Note: When returning to a byte write, remaining bits are dropped
1327
1151
  *
1328
1152
  * @param {number} value - value as int
1329
1153
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1335,7 +1159,7 @@ class biwriter {
1335
1159
  /**
1336
1160
  * Bit field writer
1337
1161
  *
1338
- * Note: When returning to a byte read, remaining bits are dropped
1162
+ * Note: When returning to a byte write, remaining bits are dropped
1339
1163
  *
1340
1164
  * @param {number} value - value as int
1341
1165
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1348,7 +1172,7 @@ class biwriter {
1348
1172
  /**
1349
1173
  * Bit field writer
1350
1174
  *
1351
- * Note: When returning to a byte read, remaining bits are dropped
1175
+ * Note: When returning to a byte write, remaining bits are dropped
1352
1176
  *
1353
1177
  * @param {number} value - value as int
1354
1178
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1360,7 +1184,7 @@ class biwriter {
1360
1184
  /**
1361
1185
  * Bit field writer
1362
1186
  *
1363
- * Note: When returning to a byte read, remaining bits are dropped
1187
+ * Note: When returning to a byte write, remaining bits are dropped
1364
1188
  *
1365
1189
  * @param {number} value - value as int
1366
1190
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1373,7 +1197,7 @@ class biwriter {
1373
1197
  /**
1374
1198
  * Bit field writer
1375
1199
  *
1376
- * Note: When returning to a byte read, remaining bits are dropped
1200
+ * Note: When returning to a byte write, remaining bits are dropped
1377
1201
  *
1378
1202
  * @param {number} value - value as int
1379
1203
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1385,7 +1209,7 @@ class biwriter {
1385
1209
  /**
1386
1210
  * Bit field writer
1387
1211
  *
1388
- * Note: When returning to a byte read, remaining bits are dropped
1212
+ * Note: When returning to a byte write, remaining bits are dropped
1389
1213
  *
1390
1214
  * @param {number} value - value as int
1391
1215
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1398,7 +1222,7 @@ class biwriter {
1398
1222
  /**
1399
1223
  * Bit field writer
1400
1224
  *
1401
- * Note: When returning to a byte read, remaining bits are dropped
1225
+ * Note: When returning to a byte write, remaining bits are dropped
1402
1226
  *
1403
1227
  * @param {number} value - value as int
1404
1228
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1410,7 +1234,7 @@ class biwriter {
1410
1234
  /**
1411
1235
  * Bit field writer
1412
1236
  *
1413
- * Note: When returning to a byte read, remaining bits are dropped
1237
+ * Note: When returning to a byte write, remaining bits are dropped
1414
1238
  *
1415
1239
  * @param {number} value - value as int
1416
1240
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1423,7 +1247,7 @@ class biwriter {
1423
1247
  /**
1424
1248
  * Bit field writer
1425
1249
  *
1426
- * Note: When returning to a byte read, remaining bits are dropped
1250
+ * Note: When returning to a byte write, remaining bits are dropped
1427
1251
  *
1428
1252
  * @param {number} value - value as int
1429
1253
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1435,7 +1259,7 @@ class biwriter {
1435
1259
  /**
1436
1260
  * Bit field writer
1437
1261
  *
1438
- * Note: When returning to a byte read, remaining bits are dropped
1262
+ * Note: When returning to a byte write, remaining bits are dropped
1439
1263
  *
1440
1264
  * @param {number} value - value as int
1441
1265
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1448,7 +1272,7 @@ class biwriter {
1448
1272
  /**
1449
1273
  * Bit field writer
1450
1274
  *
1451
- * Note: When returning to a byte read, remaining bits are dropped
1275
+ * Note: When returning to a byte write, remaining bits are dropped
1452
1276
  *
1453
1277
  * @param {number} value - value as int
1454
1278
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1460,7 +1284,7 @@ class biwriter {
1460
1284
  /**
1461
1285
  * Bit field writer
1462
1286
  *
1463
- * Note: When returning to a byte read, remaining bits are dropped
1287
+ * Note: When returning to a byte write, remaining bits are dropped
1464
1288
  *
1465
1289
  * @param {number} value - value as int
1466
1290
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1473,7 +1297,7 @@ class biwriter {
1473
1297
  /**
1474
1298
  * Bit field writer
1475
1299
  *
1476
- * Note: When returning to a byte read, remaining bits are dropped
1300
+ * Note: When returning to a byte write, remaining bits are dropped
1477
1301
  *
1478
1302
  * @param {number} value - value as int
1479
1303
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1485,7 +1309,7 @@ class biwriter {
1485
1309
  /**
1486
1310
  * Bit field writer
1487
1311
  *
1488
- * Note: When returning to a byte read, remaining bits are dropped
1312
+ * Note: When returning to a byte write, remaining bits are dropped
1489
1313
  *
1490
1314
  * @param {number} value - value as int
1491
1315
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1498,7 +1322,7 @@ class biwriter {
1498
1322
  /**
1499
1323
  * Bit field writer
1500
1324
  *
1501
- * Note: When returning to a byte read, remaining bits are dropped
1325
+ * Note: When returning to a byte write, remaining bits are dropped
1502
1326
  *
1503
1327
  * @param {number} value - value as int
1504
1328
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1510,7 +1334,7 @@ class biwriter {
1510
1334
  /**
1511
1335
  * Bit field writer
1512
1336
  *
1513
- * Note: When returning to a byte read, remaining bits are dropped
1337
+ * Note: When returning to a byte write, remaining bits are dropped
1514
1338
  *
1515
1339
  * @param {number} value - value as int
1516
1340
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1523,7 +1347,7 @@ class biwriter {
1523
1347
  /**
1524
1348
  * Bit field writer
1525
1349
  *
1526
- * Note: When returning to a byte read, remaining bits are dropped
1350
+ * Note: When returning to a byte write, remaining bits are dropped
1527
1351
  *
1528
1352
  * @param {number} value - value as int
1529
1353
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1535,7 +1359,7 @@ class biwriter {
1535
1359
  /**
1536
1360
  * Bit field writer
1537
1361
  *
1538
- * Note: When returning to a byte read, remaining bits are dropped
1362
+ * Note: When returning to a byte write, remaining bits are dropped
1539
1363
  *
1540
1364
  * @param {number} value - value as int
1541
1365
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1548,7 +1372,7 @@ class biwriter {
1548
1372
  /**
1549
1373
  * Bit field writer
1550
1374
  *
1551
- * Note: When returning to a byte read, remaining bits are dropped
1375
+ * Note: When returning to a byte write, remaining bits are dropped
1552
1376
  *
1553
1377
  * @param {number} value - value as int
1554
1378
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1560,7 +1384,7 @@ class biwriter {
1560
1384
  /**
1561
1385
  * Bit field writer
1562
1386
  *
1563
- * Note: When returning to a byte read, remaining bits are dropped
1387
+ * Note: When returning to a byte write, remaining bits are dropped
1564
1388
  *
1565
1389
  * @param {number} value - value as int
1566
1390
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1573,7 +1397,7 @@ class biwriter {
1573
1397
  /**
1574
1398
  * Bit field writer
1575
1399
  *
1576
- * Note: When returning to a byte read, remaining bits are dropped
1400
+ * Note: When returning to a byte write, remaining bits are dropped
1577
1401
  *
1578
1402
  * @param {number} value - value as int
1579
1403
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1585,7 +1409,7 @@ class biwriter {
1585
1409
  /**
1586
1410
  * Bit field writer
1587
1411
  *
1588
- * Note: When returning to a byte read, remaining bits are dropped
1412
+ * Note: When returning to a byte write, remaining bits are dropped
1589
1413
  *
1590
1414
  * @param {number} value - value as int
1591
1415
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1598,7 +1422,7 @@ class biwriter {
1598
1422
  /**
1599
1423
  * Bit field writer
1600
1424
  *
1601
- * Note: When returning to a byte read, remaining bits are dropped
1425
+ * Note: When returning to a byte write, remaining bits are dropped
1602
1426
  *
1603
1427
  * @param {number} value - value as int
1604
1428
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1610,7 +1434,7 @@ class biwriter {
1610
1434
  /**
1611
1435
  * Bit field writer
1612
1436
  *
1613
- * Note: When returning to a byte read, remaining bits are dropped
1437
+ * Note: When returning to a byte write, remaining bits are dropped
1614
1438
  *
1615
1439
  * @param {number} value - value as int
1616
1440
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1623,7 +1447,7 @@ class biwriter {
1623
1447
  /**
1624
1448
  * Bit field writer
1625
1449
  *
1626
- * Note: When returning to a byte read, remaining bits are dropped
1450
+ * Note: When returning to a byte write, remaining bits are dropped
1627
1451
  *
1628
1452
  * @param {number} value - value as int
1629
1453
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1635,7 +1459,7 @@ class biwriter {
1635
1459
  /**
1636
1460
  * Bit field writer
1637
1461
  *
1638
- * Note: When returning to a byte read, remaining bits are dropped
1462
+ * Note: When returning to a byte write, remaining bits are dropped
1639
1463
  *
1640
1464
  * @param {number} value - value as int
1641
1465
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1648,7 +1472,7 @@ class biwriter {
1648
1472
  /**
1649
1473
  * Bit field writer
1650
1474
  *
1651
- * Note: When returning to a byte read, remaining bits are dropped
1475
+ * Note: When returning to a byte write, remaining bits are dropped
1652
1476
  *
1653
1477
  * @param {number} value - value as int
1654
1478
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1660,7 +1484,7 @@ class biwriter {
1660
1484
  /**
1661
1485
  * Bit field writer
1662
1486
  *
1663
- * Note: When returning to a byte read, remaining bits are dropped
1487
+ * Note: When returning to a byte write, remaining bits are dropped
1664
1488
  *
1665
1489
  * @param {number} value - value as int
1666
1490
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1673,7 +1497,7 @@ class biwriter {
1673
1497
  /**
1674
1498
  * Bit field writer
1675
1499
  *
1676
- * Note: When returning to a byte read, remaining bits are dropped
1500
+ * Note: When returning to a byte write, remaining bits are dropped
1677
1501
  *
1678
1502
  * @param {number} value - value as int
1679
1503
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1685,7 +1509,7 @@ class biwriter {
1685
1509
  /**
1686
1510
  * Bit field writer
1687
1511
  *
1688
- * Note: When returning to a byte read, remaining bits are dropped
1512
+ * Note: When returning to a byte write, remaining bits are dropped
1689
1513
  *
1690
1514
  * @param {number} value - value as int
1691
1515
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1698,7 +1522,7 @@ class biwriter {
1698
1522
  /**
1699
1523
  * Bit field writer
1700
1524
  *
1701
- * Note: When returning to a byte read, remaining bits are dropped
1525
+ * Note: When returning to a byte write, remaining bits are dropped
1702
1526
  *
1703
1527
  * @param {number} value - value as int
1704
1528
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1710,7 +1534,7 @@ class biwriter {
1710
1534
  /**
1711
1535
  * Bit field writer
1712
1536
  *
1713
- * Note: When returning to a byte read, remaining bits are dropped
1537
+ * Note: When returning to a byte write, remaining bits are dropped
1714
1538
  *
1715
1539
  * @param {number} value - value as int
1716
1540
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1723,7 +1547,7 @@ class biwriter {
1723
1547
  /**
1724
1548
  * Bit field writer
1725
1549
  *
1726
- * Note: When returning to a byte read, remaining bits are dropped
1550
+ * Note: When returning to a byte write, remaining bits are dropped
1727
1551
  *
1728
1552
  * @param {number} value - value as int
1729
1553
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1735,7 +1559,7 @@ class biwriter {
1735
1559
  /**
1736
1560
  * Bit field writer
1737
1561
  *
1738
- * Note: When returning to a byte read, remaining bits are dropped
1562
+ * Note: When returning to a byte write, remaining bits are dropped
1739
1563
  *
1740
1564
  * @param {number} value - value as int
1741
1565
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1748,7 +1572,7 @@ class biwriter {
1748
1572
  /**
1749
1573
  * Bit field writer
1750
1574
  *
1751
- * Note: When returning to a byte read, remaining bits are dropped
1575
+ * Note: When returning to a byte write, remaining bits are dropped
1752
1576
  *
1753
1577
  * @param {number} value - value as int
1754
1578
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1760,7 +1584,7 @@ class biwriter {
1760
1584
  /**
1761
1585
  * Bit field writer
1762
1586
  *
1763
- * Note: When returning to a byte read, remaining bits are dropped
1587
+ * Note: When returning to a byte write, remaining bits are dropped
1764
1588
  *
1765
1589
  * @param {number} value - value as int
1766
1590
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1773,7 +1597,7 @@ class biwriter {
1773
1597
  /**
1774
1598
  * Bit field writer
1775
1599
  *
1776
- * Note: When returning to a byte read, remaining bits are dropped
1600
+ * Note: When returning to a byte write, remaining bits are dropped
1777
1601
  *
1778
1602
  * @param {number} value - value as int
1779
1603
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1785,7 +1609,7 @@ class biwriter {
1785
1609
  /**
1786
1610
  * Bit field writer
1787
1611
  *
1788
- * Note: When returning to a byte read, remaining bits are dropped
1612
+ * Note: When returning to a byte write, remaining bits are dropped
1789
1613
  *
1790
1614
  * @param {number} value - value as int
1791
1615
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1798,7 +1622,7 @@ class biwriter {
1798
1622
  /**
1799
1623
  * Bit field writer
1800
1624
  *
1801
- * Note: When returning to a byte read, remaining bits are dropped
1625
+ * Note: When returning to a byte write, remaining bits are dropped
1802
1626
  *
1803
1627
  * @param {number} value - value as int
1804
1628
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1810,7 +1634,7 @@ class biwriter {
1810
1634
  /**
1811
1635
  * Bit field writer
1812
1636
  *
1813
- * Note: When returning to a byte read, remaining bits are dropped
1637
+ * Note: When returning to a byte write, remaining bits are dropped
1814
1638
  *
1815
1639
  * @param {number} value - value as int
1816
1640
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1823,7 +1647,7 @@ class biwriter {
1823
1647
  /**
1824
1648
  * Bit field writer
1825
1649
  *
1826
- * Note: When returning to a byte read, remaining bits are dropped
1650
+ * Note: When returning to a byte write, remaining bits are dropped
1827
1651
  *
1828
1652
  * @param {number} value - value as int
1829
1653
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1835,7 +1659,7 @@ class biwriter {
1835
1659
  /**
1836
1660
  * Bit field writer
1837
1661
  *
1838
- * Note: When returning to a byte read, remaining bits are dropped
1662
+ * Note: When returning to a byte write, remaining bits are dropped
1839
1663
  *
1840
1664
  * @param {number} value - value as int
1841
1665
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1848,7 +1672,7 @@ class biwriter {
1848
1672
  /**
1849
1673
  * Bit field writer
1850
1674
  *
1851
- * Note: When returning to a byte read, remaining bits are dropped
1675
+ * Note: When returning to a byte write, remaining bits are dropped
1852
1676
  *
1853
1677
  * @param {number} value - value as int
1854
1678
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1860,7 +1684,7 @@ class biwriter {
1860
1684
  /**
1861
1685
  * Bit field writer
1862
1686
  *
1863
- * Note: When returning to a byte read, remaining bits are dropped
1687
+ * Note: When returning to a byte write, remaining bits are dropped
1864
1688
  *
1865
1689
  * @param {number} value - value as int
1866
1690
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1873,7 +1697,7 @@ class biwriter {
1873
1697
  /**
1874
1698
  * Bit field writer
1875
1699
  *
1876
- * Note: When returning to a byte read, remaining bits are dropped
1700
+ * Note: When returning to a byte write, remaining bits are dropped
1877
1701
  *
1878
1702
  * @param {number} value - value as int
1879
1703
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1885,7 +1709,7 @@ class biwriter {
1885
1709
  /**
1886
1710
  * Bit field writer
1887
1711
  *
1888
- * Note: When returning to a byte read, remaining bits are dropped
1712
+ * Note: When returning to a byte write, remaining bits are dropped
1889
1713
  *
1890
1714
  * @param {number} value - value as int
1891
1715
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1898,7 +1722,7 @@ class biwriter {
1898
1722
  /**
1899
1723
  * Bit field writer
1900
1724
  *
1901
- * Note: When returning to a byte read, remaining bits are dropped
1725
+ * Note: When returning to a byte write, remaining bits are dropped
1902
1726
  *
1903
1727
  * @param {number} value - value as int
1904
1728
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1910,7 +1734,7 @@ class biwriter {
1910
1734
  /**
1911
1735
  * Bit field writer
1912
1736
  *
1913
- * Note: When returning to a byte read, remaining bits are dropped
1737
+ * Note: When returning to a byte write, remaining bits are dropped
1914
1738
  *
1915
1739
  * @param {number} value - value as int
1916
1740
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1923,7 +1747,7 @@ class biwriter {
1923
1747
  /**
1924
1748
  * Bit field writer
1925
1749
  *
1926
- * Note: When returning to a byte read, remaining bits are dropped
1750
+ * Note: When returning to a byte write, remaining bits are dropped
1927
1751
  *
1928
1752
  * @param {number} value - value as int
1929
1753
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1935,7 +1759,7 @@ class biwriter {
1935
1759
  /**
1936
1760
  * Bit field writer
1937
1761
  *
1938
- * Note: When returning to a byte read, remaining bits are dropped
1762
+ * Note: When returning to a byte write, remaining bits are dropped
1939
1763
  *
1940
1764
  * @param {number} value - value as int
1941
1765
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1948,7 +1772,7 @@ class biwriter {
1948
1772
  /**
1949
1773
  * Bit field writer
1950
1774
  *
1951
- * Note: When returning to a byte read, remaining bits are dropped
1775
+ * Note: When returning to a byte write, remaining bits are dropped
1952
1776
  *
1953
1777
  * @param {number} value - value as int
1954
1778
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1960,7 +1784,7 @@ class biwriter {
1960
1784
  /**
1961
1785
  * Bit field writer
1962
1786
  *
1963
- * Note: When returning to a byte read, remaining bits are dropped
1787
+ * Note: When returning to a byte write, remaining bits are dropped
1964
1788
  *
1965
1789
  * @param {number} value - value as int
1966
1790
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1973,7 +1797,7 @@ class biwriter {
1973
1797
  /**
1974
1798
  * Bit field writer
1975
1799
  *
1976
- * Note: When returning to a byte read, remaining bits are dropped
1800
+ * Note: When returning to a byte write, remaining bits are dropped
1977
1801
  *
1978
1802
  * @param {number} value - value as int
1979
1803
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1985,7 +1809,7 @@ class biwriter {
1985
1809
  /**
1986
1810
  * Bit field writer
1987
1811
  *
1988
- * Note: When returning to a byte read, remaining bits are dropped
1812
+ * Note: When returning to a byte write, remaining bits are dropped
1989
1813
  *
1990
1814
  * @param {number} value - value as int
1991
1815
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1998,7 +1822,7 @@ class biwriter {
1998
1822
  /**
1999
1823
  * Bit field writer
2000
1824
  *
2001
- * Note: When returning to a byte read, remaining bits are dropped
1825
+ * Note: When returning to a byte write, remaining bits are dropped
2002
1826
  *
2003
1827
  * @param {number} value - value as int
2004
1828
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2010,7 +1834,7 @@ class biwriter {
2010
1834
  /**
2011
1835
  * Bit field writer
2012
1836
  *
2013
- * Note: When returning to a byte read, remaining bits are dropped
1837
+ * Note: When returning to a byte write, remaining bits are dropped
2014
1838
  *
2015
1839
  * @param {number} value - value as int
2016
1840
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2023,7 +1847,7 @@ class biwriter {
2023
1847
  /**
2024
1848
  * Bit field writer
2025
1849
  *
2026
- * Note: When returning to a byte read, remaining bits are dropped
1850
+ * Note: When returning to a byte write, remaining bits are dropped
2027
1851
  *
2028
1852
  * @param {number} value - value as int
2029
1853
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2035,7 +1859,7 @@ class biwriter {
2035
1859
  /**
2036
1860
  * Bit field writer
2037
1861
  *
2038
- * Note: When returning to a byte read, remaining bits are dropped
1862
+ * Note: When returning to a byte write, remaining bits are dropped
2039
1863
  *
2040
1864
  * @param {number} value - value as int
2041
1865
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2048,7 +1872,7 @@ class biwriter {
2048
1872
  /**
2049
1873
  * Bit field writer
2050
1874
  *
2051
- * Note: When returning to a byte read, remaining bits are dropped
1875
+ * Note: When returning to a byte write, remaining bits are dropped
2052
1876
  *
2053
1877
  * @param {number} value - value as int
2054
1878
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2060,7 +1884,7 @@ class biwriter {
2060
1884
  /**
2061
1885
  * Bit field writer
2062
1886
  *
2063
- * Note: When returning to a byte read, remaining bits are dropped
1887
+ * Note: When returning to a byte write, remaining bits are dropped
2064
1888
  *
2065
1889
  * @param {number} value - value as int
2066
1890
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2073,7 +1897,7 @@ class biwriter {
2073
1897
  /**
2074
1898
  * Bit field writer
2075
1899
  *
2076
- * Note: When returning to a byte read, remaining bits are dropped
1900
+ * Note: When returning to a byte write, remaining bits are dropped
2077
1901
  *
2078
1902
  * @param {number} value - value as int
2079
1903
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2085,7 +1909,7 @@ class biwriter {
2085
1909
  /**
2086
1910
  * Bit field writer
2087
1911
  *
2088
- * Note: When returning to a byte read, remaining bits are dropped
1912
+ * Note: When returning to a byte write, remaining bits are dropped
2089
1913
  *
2090
1914
  * @param {number} value - value as int
2091
1915
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2098,7 +1922,7 @@ class biwriter {
2098
1922
  /**
2099
1923
  * Bit field writer
2100
1924
  *
2101
- * Note: When returning to a byte read, remaining bits are dropped
1925
+ * Note: When returning to a byte write, remaining bits are dropped
2102
1926
  *
2103
1927
  * @param {number} value - value as int
2104
1928
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2110,7 +1934,7 @@ class biwriter {
2110
1934
  /**
2111
1935
  * Bit field writer
2112
1936
  *
2113
- * Note: When returning to a byte read, remaining bits are dropped
1937
+ * Note: When returning to a byte write, remaining bits are dropped
2114
1938
  *
2115
1939
  * @param {number} value - value as int
2116
1940
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2123,7 +1947,7 @@ class biwriter {
2123
1947
  /**
2124
1948
  * Bit field writer
2125
1949
  *
2126
- * Note: When returning to a byte read, remaining bits are dropped
1950
+ * Note: When returning to a byte write, remaining bits are dropped
2127
1951
  *
2128
1952
  * @param {number} value - value as int
2129
1953
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2135,7 +1959,7 @@ class biwriter {
2135
1959
  /**
2136
1960
  * Bit field writer
2137
1961
  *
2138
- * Note: When returning to a byte read, remaining bits are dropped
1962
+ * Note: When returning to a byte write, remaining bits are dropped
2139
1963
  *
2140
1964
  * @param {number} value - value as int
2141
1965
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2148,7 +1972,7 @@ class biwriter {
2148
1972
  /**
2149
1973
  * Bit field writer
2150
1974
  *
2151
- * Note: When returning to a byte read, remaining bits are dropped
1975
+ * Note: When returning to a byte write, remaining bits are dropped
2152
1976
  *
2153
1977
  * @param {number} value - value as int
2154
1978
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2160,7 +1984,7 @@ class biwriter {
2160
1984
  /**
2161
1985
  * Bit field writer
2162
1986
  *
2163
- * Note: When returning to a byte read, remaining bits are dropped
1987
+ * Note: When returning to a byte write, remaining bits are dropped
2164
1988
  *
2165
1989
  * @param {number} value - value as int
2166
1990
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2173,7 +1997,7 @@ class biwriter {
2173
1997
  /**
2174
1998
  * Bit field writer
2175
1999
  *
2176
- * Note: When returning to a byte read, remaining bits are dropped
2000
+ * Note: When returning to a byte write, remaining bits are dropped
2177
2001
  *
2178
2002
  * @param {number} value - value as int
2179
2003
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2185,7 +2009,7 @@ class biwriter {
2185
2009
  /**
2186
2010
  * Bit field writer
2187
2011
  *
2188
- * Note: When returning to a byte read, remaining bits are dropped
2012
+ * Note: When returning to a byte write, remaining bits are dropped
2189
2013
  *
2190
2014
  * @param {number} value - value as int
2191
2015
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2198,7 +2022,7 @@ class biwriter {
2198
2022
  /**
2199
2023
  * Bit field writer
2200
2024
  *
2201
- * Note: When returning to a byte read, remaining bits are dropped
2025
+ * Note: When returning to a byte write, remaining bits are dropped
2202
2026
  *
2203
2027
  * @param {number} value - value as int
2204
2028
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2210,7 +2034,7 @@ class biwriter {
2210
2034
  /**
2211
2035
  * Bit field writer
2212
2036
  *
2213
- * Note: When returning to a byte read, remaining bits are dropped
2037
+ * Note: When returning to a byte write, remaining bits are dropped
2214
2038
  *
2215
2039
  * @param {number} value - value as int
2216
2040
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2223,7 +2047,7 @@ class biwriter {
2223
2047
  /**
2224
2048
  * Bit field writer
2225
2049
  *
2226
- * Note: When returning to a byte read, remaining bits are dropped
2050
+ * Note: When returning to a byte write, remaining bits are dropped
2227
2051
  *
2228
2052
  * @param {number} value - value as int
2229
2053
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2235,7 +2059,7 @@ class biwriter {
2235
2059
  /**
2236
2060
  * Bit field writer
2237
2061
  *
2238
- * Note: When returning to a byte read, remaining bits are dropped
2062
+ * Note: When returning to a byte write, remaining bits are dropped
2239
2063
  *
2240
2064
  * @param {number} value - value as int
2241
2065
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2248,7 +2072,7 @@ class biwriter {
2248
2072
  /**
2249
2073
  * Bit field writer
2250
2074
  *
2251
- * Note: When returning to a byte read, remaining bits are dropped
2075
+ * Note: When returning to a byte write, remaining bits are dropped
2252
2076
  *
2253
2077
  * @param {number} value - value as int
2254
2078
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2260,7 +2084,7 @@ class biwriter {
2260
2084
  /**
2261
2085
  * Bit field writer
2262
2086
  *
2263
- * Note: When returning to a byte read, remaining bits are dropped
2087
+ * Note: When returning to a byte write, remaining bits are dropped
2264
2088
  *
2265
2089
  * @param {number} value - value as int
2266
2090
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2273,7 +2097,7 @@ class biwriter {
2273
2097
  /**
2274
2098
  * Bit field writer
2275
2099
  *
2276
- * Note: When returning to a byte read, remaining bits are dropped
2100
+ * Note: When returning to a byte write, remaining bits are dropped
2277
2101
  *
2278
2102
  * @param {number} value - value as int
2279
2103
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2285,7 +2109,7 @@ class biwriter {
2285
2109
  /**
2286
2110
  * Bit field writer
2287
2111
  *
2288
- * Note: When returning to a byte read, remaining bits are dropped
2112
+ * Note: When returning to a byte write, remaining bits are dropped
2289
2113
  *
2290
2114
  * @param {number} value - value as int
2291
2115
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2298,7 +2122,7 @@ class biwriter {
2298
2122
  /**
2299
2123
  * Bit field writer
2300
2124
  *
2301
- * Note: When returning to a byte read, remaining bits are dropped
2125
+ * Note: When returning to a byte write, remaining bits are dropped
2302
2126
  *
2303
2127
  * @param {number} value - value as int
2304
2128
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2310,7 +2134,7 @@ class biwriter {
2310
2134
  /**
2311
2135
  * Bit field writer
2312
2136
  *
2313
- * Note: When returning to a byte read, remaining bits are dropped
2137
+ * Note: When returning to a byte write, remaining bits are dropped
2314
2138
  *
2315
2139
  * @param {number} value - value as int
2316
2140
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2323,7 +2147,7 @@ class biwriter {
2323
2147
  /**
2324
2148
  * Bit field writer
2325
2149
  *
2326
- * Note: When returning to a byte read, remaining bits are dropped
2150
+ * Note: When returning to a byte write, remaining bits are dropped
2327
2151
  *
2328
2152
  * @param {number} value - value as int
2329
2153
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2335,7 +2159,7 @@ class biwriter {
2335
2159
  /**
2336
2160
  * Bit field writer
2337
2161
  *
2338
- * Note: When returning to a byte read, remaining bits are dropped
2162
+ * Note: When returning to a byte write, remaining bits are dropped
2339
2163
  *
2340
2164
  * @param {number} value - value as int
2341
2165
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2348,7 +2172,7 @@ class biwriter {
2348
2172
  /**
2349
2173
  * Bit field writer
2350
2174
  *
2351
- * Note: When returning to a byte read, remaining bits are dropped
2175
+ * Note: When returning to a byte write, remaining bits are dropped
2352
2176
  *
2353
2177
  * @param {number} value - value as int
2354
2178
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2360,7 +2184,7 @@ class biwriter {
2360
2184
  /**
2361
2185
  * Bit field writer
2362
2186
  *
2363
- * Note: When returning to a byte read, remaining bits are dropped
2187
+ * Note: When returning to a byte write, remaining bits are dropped
2364
2188
  *
2365
2189
  * @param {number} value - value as int
2366
2190
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2373,7 +2197,7 @@ class biwriter {
2373
2197
  /**
2374
2198
  * Bit field writer
2375
2199
  *
2376
- * Note: When returning to a byte read, remaining bits are dropped
2200
+ * Note: When returning to a byte write, remaining bits are dropped
2377
2201
  *
2378
2202
  * @param {number} value - value as int
2379
2203
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2385,7 +2209,7 @@ class biwriter {
2385
2209
  /**
2386
2210
  * Bit field writer
2387
2211
  *
2388
- * Note: When returning to a byte read, remaining bits are dropped
2212
+ * Note: When returning to a byte write, remaining bits are dropped
2389
2213
  *
2390
2214
  * @param {number} value - value as int
2391
2215
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2398,7 +2222,7 @@ class biwriter {
2398
2222
  /**
2399
2223
  * Bit field writer
2400
2224
  *
2401
- * Note: When returning to a byte read, remaining bits are dropped
2225
+ * Note: When returning to a byte write, remaining bits are dropped
2402
2226
  *
2403
2227
  * @param {number} value - value as int
2404
2228
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2410,7 +2234,7 @@ class biwriter {
2410
2234
  /**
2411
2235
  * Bit field writer
2412
2236
  *
2413
- * Note: When returning to a byte read, remaining bits are dropped
2237
+ * Note: When returning to a byte write, remaining bits are dropped
2414
2238
  *
2415
2239
  * @param {number} value - value as int
2416
2240
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2423,7 +2247,7 @@ class biwriter {
2423
2247
  /**
2424
2248
  * Bit field writer
2425
2249
  *
2426
- * Note: When returning to a byte read, remaining bits are dropped
2250
+ * Note: When returning to a byte write, remaining bits are dropped
2427
2251
  *
2428
2252
  * @param {number} value - value as int
2429
2253
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2435,7 +2259,7 @@ class biwriter {
2435
2259
  /**
2436
2260
  * Bit field writer
2437
2261
  *
2438
- * Note: When returning to a byte read, remaining bits are dropped
2262
+ * Note: When returning to a byte write, remaining bits are dropped
2439
2263
  *
2440
2264
  * @param {number} value - value as int
2441
2265
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2448,7 +2272,7 @@ class biwriter {
2448
2272
  /**
2449
2273
  * Bit field writer
2450
2274
  *
2451
- * Note: When returning to a byte read, remaining bits are dropped
2275
+ * Note: When returning to a byte write, remaining bits are dropped
2452
2276
  *
2453
2277
  * @param {number} value - value as int
2454
2278
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2460,7 +2284,7 @@ class biwriter {
2460
2284
  /**
2461
2285
  * Bit field writer
2462
2286
  *
2463
- * Note: When returning to a byte read, remaining bits are dropped
2287
+ * Note: When returning to a byte write, remaining bits are dropped
2464
2288
  *
2465
2289
  * @param {number} value - value as int
2466
2290
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2473,7 +2297,7 @@ class biwriter {
2473
2297
  /**
2474
2298
  * Bit field writer
2475
2299
  *
2476
- * Note: When returning to a byte read, remaining bits are dropped
2300
+ * Note: When returning to a byte write, remaining bits are dropped
2477
2301
  *
2478
2302
  * @param {number} value - value as int
2479
2303
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2485,7 +2309,7 @@ class biwriter {
2485
2309
  /**
2486
2310
  * Bit field writer
2487
2311
  *
2488
- * Note: When returning to a byte read, remaining bits are dropped
2312
+ * Note: When returning to a byte write, remaining bits are dropped
2489
2313
  *
2490
2314
  * @param {number} value - value as int
2491
2315
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2498,7 +2322,7 @@ class biwriter {
2498
2322
  /**
2499
2323
  * Bit field writer
2500
2324
  *
2501
- * Note: When returning to a byte read, remaining bits are dropped
2325
+ * Note: When returning to a byte write, remaining bits are dropped
2502
2326
  *
2503
2327
  * @param {number} value - value as int
2504
2328
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2510,7 +2334,7 @@ class biwriter {
2510
2334
  /**
2511
2335
  * Bit field writer
2512
2336
  *
2513
- * Note: When returning to a byte read, remaining bits are dropped
2337
+ * Note: When returning to a byte write, remaining bits are dropped
2514
2338
  *
2515
2339
  * @param {number} value - value as int
2516
2340
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2523,7 +2347,7 @@ class biwriter {
2523
2347
  /**
2524
2348
  * Bit field writer
2525
2349
  *
2526
- * Note: When returning to a byte read, remaining bits are dropped
2350
+ * Note: When returning to a byte write, remaining bits are dropped
2527
2351
  *
2528
2352
  * @param {number} value - value as int
2529
2353
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2535,7 +2359,7 @@ class biwriter {
2535
2359
  /**
2536
2360
  * Bit field writer
2537
2361
  *
2538
- * Note: When returning to a byte read, remaining bits are dropped
2362
+ * Note: When returning to a byte write, remaining bits are dropped
2539
2363
  *
2540
2364
  * @param {number} value - value as int
2541
2365
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2548,7 +2372,7 @@ class biwriter {
2548
2372
  /**
2549
2373
  * Bit field writer
2550
2374
  *
2551
- * Note: When returning to a byte read, remaining bits are dropped
2375
+ * Note: When returning to a byte write, remaining bits are dropped
2552
2376
  *
2553
2377
  * @param {number} value - value as int
2554
2378
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2560,7 +2384,7 @@ class biwriter {
2560
2384
  /**
2561
2385
  * Bit field writer
2562
2386
  *
2563
- * Note: When returning to a byte read, remaining bits are dropped
2387
+ * Note: When returning to a byte write, remaining bits are dropped
2564
2388
  *
2565
2389
  * @param {number} value - value as int
2566
2390
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2573,7 +2397,7 @@ class biwriter {
2573
2397
  /**
2574
2398
  * Bit field writer
2575
2399
  *
2576
- * Note: When returning to a byte read, remaining bits are dropped
2400
+ * Note: When returning to a byte write, remaining bits are dropped
2577
2401
  *
2578
2402
  * @param {number} value - value as int
2579
2403
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2585,7 +2409,7 @@ class biwriter {
2585
2409
  /**
2586
2410
  * Bit field writer
2587
2411
  *
2588
- * Note: When returning to a byte read, remaining bits are dropped
2412
+ * Note: When returning to a byte write, remaining bits are dropped
2589
2413
  *
2590
2414
  * @param {number} value - value as int
2591
2415
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2598,7 +2422,7 @@ class biwriter {
2598
2422
  /**
2599
2423
  * Bit field writer
2600
2424
  *
2601
- * Note: When returning to a byte read, remaining bits are dropped
2425
+ * Note: When returning to a byte write, remaining bits are dropped
2602
2426
  *
2603
2427
  * @param {number} value - value as int
2604
2428
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2610,7 +2434,7 @@ class biwriter {
2610
2434
  /**
2611
2435
  * Bit field writer
2612
2436
  *
2613
- * Note: When returning to a byte read, remaining bits are dropped
2437
+ * Note: When returning to a byte write, remaining bits are dropped
2614
2438
  *
2615
2439
  * @param {number} value - value as int
2616
2440
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2623,7 +2447,7 @@ class biwriter {
2623
2447
  /**
2624
2448
  * Bit field writer
2625
2449
  *
2626
- * Note: When returning to a byte read, remaining bits are dropped
2450
+ * Note: When returning to a byte write, remaining bits are dropped
2627
2451
  *
2628
2452
  * @param {number} value - value as int
2629
2453
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2635,7 +2459,7 @@ class biwriter {
2635
2459
  /**
2636
2460
  * Bit field writer
2637
2461
  *
2638
- * Note: When returning to a byte read, remaining bits are dropped
2462
+ * Note: When returning to a byte write, remaining bits are dropped
2639
2463
  *
2640
2464
  * @param {number} value - value as int
2641
2465
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2648,7 +2472,7 @@ class biwriter {
2648
2472
  /**
2649
2473
  * Bit field writer
2650
2474
  *
2651
- * Note: When returning to a byte read, remaining bits are dropped
2475
+ * Note: When returning to a byte write, remaining bits are dropped
2652
2476
  *
2653
2477
  * @param {number} value - value as int
2654
2478
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2660,7 +2484,7 @@ class biwriter {
2660
2484
  /**
2661
2485
  * Bit field writer
2662
2486
  *
2663
- * Note: When returning to a byte read, remaining bits are dropped
2487
+ * Note: When returning to a byte write, remaining bits are dropped
2664
2488
  *
2665
2489
  * @param {number} value - value as int
2666
2490
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2673,7 +2497,7 @@ class biwriter {
2673
2497
  /**
2674
2498
  * Bit field writer
2675
2499
  *
2676
- * Note: When returning to a byte read, remaining bits are dropped
2500
+ * Note: When returning to a byte write, remaining bits are dropped
2677
2501
  *
2678
2502
  * @param {number} value - value as int
2679
2503
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2685,7 +2509,7 @@ class biwriter {
2685
2509
  /**
2686
2510
  * Bit field writer
2687
2511
  *
2688
- * Note: When returning to a byte read, remaining bits are dropped
2512
+ * Note: When returning to a byte write, remaining bits are dropped
2689
2513
  *
2690
2514
  * @param {number} value - value as int
2691
2515
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2698,7 +2522,7 @@ class biwriter {
2698
2522
  /**
2699
2523
  * Bit field writer
2700
2524
  *
2701
- * Note: When returning to a byte read, remaining bits are dropped
2525
+ * Note: When returning to a byte write, remaining bits are dropped
2702
2526
  *
2703
2527
  * @param {number} value - value as int
2704
2528
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2710,7 +2534,7 @@ class biwriter {
2710
2534
  /**
2711
2535
  * Bit field writer
2712
2536
  *
2713
- * Note: When returning to a byte read, remaining bits are dropped
2537
+ * Note: When returning to a byte write, remaining bits are dropped
2714
2538
  *
2715
2539
  * @param {number} value - value as int
2716
2540
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2723,7 +2547,7 @@ class biwriter {
2723
2547
  /**
2724
2548
  * Bit field writer
2725
2549
  *
2726
- * Note: When returning to a byte read, remaining bits are dropped
2550
+ * Note: When returning to a byte write, remaining bits are dropped
2727
2551
  *
2728
2552
  * @param {number} value - value as int
2729
2553
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2735,7 +2559,7 @@ class biwriter {
2735
2559
  /**
2736
2560
  * Bit field writer
2737
2561
  *
2738
- * Note: When returning to a byte read, remaining bits are dropped
2562
+ * Note: When returning to a byte write, remaining bits are dropped
2739
2563
  *
2740
2564
  * @param {number} value - value as int
2741
2565
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2748,7 +2572,7 @@ class biwriter {
2748
2572
  /**
2749
2573
  * Bit field writer
2750
2574
  *
2751
- * Note: When returning to a byte read, remaining bits are dropped
2575
+ * Note: When returning to a byte write, remaining bits are dropped
2752
2576
  *
2753
2577
  * @param {number} value - value as int
2754
2578
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2760,7 +2584,7 @@ class biwriter {
2760
2584
  /**
2761
2585
  * Bit field writer
2762
2586
  *
2763
- * Note: When returning to a byte read, remaining bits are dropped
2587
+ * Note: When returning to a byte write, remaining bits are dropped
2764
2588
  *
2765
2589
  * @param {number} value - value as int
2766
2590
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2773,7 +2597,7 @@ class biwriter {
2773
2597
  /**
2774
2598
  * Bit field writer
2775
2599
  *
2776
- * Note: When returning to a byte read, remaining bits are dropped
2600
+ * Note: When returning to a byte write, remaining bits are dropped
2777
2601
  *
2778
2602
  * @param {number} value - value as int
2779
2603
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2785,7 +2609,7 @@ class biwriter {
2785
2609
  /**
2786
2610
  * Bit field writer
2787
2611
  *
2788
- * Note: When returning to a byte read, remaining bits are dropped
2612
+ * Note: When returning to a byte write, remaining bits are dropped
2789
2613
  *
2790
2614
  * @param {number} value - value as int
2791
2615
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2798,7 +2622,7 @@ class biwriter {
2798
2622
  /**
2799
2623
  * Bit field writer
2800
2624
  *
2801
- * Note: When returning to a byte read, remaining bits are dropped
2625
+ * Note: When returning to a byte write, remaining bits are dropped
2802
2626
  *
2803
2627
  * @param {number} value - value as int
2804
2628
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2810,7 +2634,7 @@ class biwriter {
2810
2634
  /**
2811
2635
  * Bit field writer
2812
2636
  *
2813
- * Note: When returning to a byte read, remaining bits are dropped
2637
+ * Note: When returning to a byte write, remaining bits are dropped
2814
2638
  *
2815
2639
  * @param {number} value - value as int
2816
2640
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2823,7 +2647,7 @@ class biwriter {
2823
2647
  /**
2824
2648
  * Bit field writer
2825
2649
  *
2826
- * Note: When returning to a byte read, remaining bits are dropped
2650
+ * Note: When returning to a byte write, remaining bits are dropped
2827
2651
  *
2828
2652
  * @param {number} value - value as int
2829
2653
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2835,7 +2659,7 @@ class biwriter {
2835
2659
  /**
2836
2660
  * Bit field writer
2837
2661
  *
2838
- * Note: When returning to a byte read, remaining bits are dropped
2662
+ * Note: When returning to a byte write, remaining bits are dropped
2839
2663
  *
2840
2664
  * @param {number} value - value as int
2841
2665
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2848,7 +2672,7 @@ class biwriter {
2848
2672
  /**
2849
2673
  * Bit field writer
2850
2674
  *
2851
- * Note: When returning to a byte read, remaining bits are dropped
2675
+ * Note: When returning to a byte write, remaining bits are dropped
2852
2676
  *
2853
2677
  * @param {number} value - value as int
2854
2678
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2860,7 +2684,7 @@ class biwriter {
2860
2684
  /**
2861
2685
  * Bit field writer
2862
2686
  *
2863
- * Note: When returning to a byte read, remaining bits are dropped
2687
+ * Note: When returning to a byte write, remaining bits are dropped
2864
2688
  *
2865
2689
  * @param {number} value - value as int
2866
2690
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2873,7 +2697,7 @@ class biwriter {
2873
2697
  /**
2874
2698
  * Bit field writer
2875
2699
  *
2876
- * Note: When returning to a byte read, remaining bits are dropped
2700
+ * Note: When returning to a byte write, remaining bits are dropped
2877
2701
  *
2878
2702
  * @param {number} value - value as int
2879
2703
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2885,7 +2709,7 @@ class biwriter {
2885
2709
  /**
2886
2710
  * Bit field writer
2887
2711
  *
2888
- * Note: When returning to a byte read, remaining bits are dropped
2712
+ * Note: When returning to a byte write, remaining bits are dropped
2889
2713
  *
2890
2714
  * @param {number} value - value as int
2891
2715
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2898,7 +2722,7 @@ class biwriter {
2898
2722
  /**
2899
2723
  * Bit field writer
2900
2724
  *
2901
- * Note: When returning to a byte read, remaining bits are dropped
2725
+ * Note: When returning to a byte write, remaining bits are dropped
2902
2726
  *
2903
2727
  * @param {number} value - value as int
2904
2728
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2910,7 +2734,7 @@ class biwriter {
2910
2734
  /**
2911
2735
  * Bit field writer
2912
2736
  *
2913
- * Note: When returning to a byte read, remaining bits are dropped
2737
+ * Note: When returning to a byte write, remaining bits are dropped
2914
2738
  *
2915
2739
  * @param {number} value - value as int
2916
2740
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2923,7 +2747,7 @@ class biwriter {
2923
2747
  /**
2924
2748
  * Bit field writer
2925
2749
  *
2926
- * Note: When returning to a byte read, remaining bits are dropped
2750
+ * Note: When returning to a byte write, remaining bits are dropped
2927
2751
  *
2928
2752
  * @param {number} value - value as int
2929
2753
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2935,7 +2759,7 @@ class biwriter {
2935
2759
  /**
2936
2760
  * Bit field writer
2937
2761
  *
2938
- * Note: When returning to a byte read, remaining bits are dropped
2762
+ * Note: When returning to a byte write, remaining bits are dropped
2939
2763
  *
2940
2764
  * @param {number} value - value as int
2941
2765
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2948,7 +2772,7 @@ class biwriter {
2948
2772
  /**
2949
2773
  * Bit field writer
2950
2774
  *
2951
- * Note: When returning to a byte read, remaining bits are dropped
2775
+ * Note: When returning to a byte write, remaining bits are dropped
2952
2776
  *
2953
2777
  * @param {number} value - value as int
2954
2778
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2960,7 +2784,7 @@ class biwriter {
2960
2784
  /**
2961
2785
  * Bit field writer
2962
2786
  *
2963
- * Note: When returning to a byte read, remaining bits are dropped
2787
+ * Note: When returning to a byte write, remaining bits are dropped
2964
2788
  *
2965
2789
  * @param {number} value - value as int
2966
2790
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2973,7 +2797,7 @@ class biwriter {
2973
2797
  /**
2974
2798
  * Bit field writer
2975
2799
  *
2976
- * Note: When returning to a byte read, remaining bits are dropped
2800
+ * Note: When returning to a byte write, remaining bits are dropped
2977
2801
  *
2978
2802
  * @param {number} value - value as int
2979
2803
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2985,7 +2809,7 @@ class biwriter {
2985
2809
  /**
2986
2810
  * Bit field writer
2987
2811
  *
2988
- * Note: When returning to a byte read, remaining bits are dropped
2812
+ * Note: When returning to a byte write, remaining bits are dropped
2989
2813
  *
2990
2814
  * @param {number} value - value as int
2991
2815
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2998,7 +2822,7 @@ class biwriter {
2998
2822
  /**
2999
2823
  * Bit field writer
3000
2824
  *
3001
- * Note: When returning to a byte read, remaining bits are dropped
2825
+ * Note: When returning to a byte write, remaining bits are dropped
3002
2826
  *
3003
2827
  * @param {number} value - value as int
3004
2828
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3010,7 +2834,7 @@ class biwriter {
3010
2834
  /**
3011
2835
  * Bit field writer
3012
2836
  *
3013
- * Note: When returning to a byte read, remaining bits are dropped
2837
+ * Note: When returning to a byte write, remaining bits are dropped
3014
2838
  *
3015
2839
  * @param {number} value - value as int
3016
2840
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3023,7 +2847,7 @@ class biwriter {
3023
2847
  /**
3024
2848
  * Bit field writer
3025
2849
  *
3026
- * Note: When returning to a byte read, remaining bits are dropped
2850
+ * Note: When returning to a byte write, remaining bits are dropped
3027
2851
  *
3028
2852
  * @param {number} value - value as int
3029
2853
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3035,7 +2859,7 @@ class biwriter {
3035
2859
  /**
3036
2860
  * Bit field writer
3037
2861
  *
3038
- * Note: When returning to a byte read, remaining bits are dropped
2862
+ * Note: When returning to a byte write, remaining bits are dropped
3039
2863
  *
3040
2864
  * @param {number} value - value as int
3041
2865
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3048,7 +2872,7 @@ class biwriter {
3048
2872
  /**
3049
2873
  * Bit field writer
3050
2874
  *
3051
- * Note: When returning to a byte read, remaining bits are dropped
2875
+ * Note: When returning to a byte write, remaining bits are dropped
3052
2876
  *
3053
2877
  * @param {number} value - value as int
3054
2878
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3060,7 +2884,7 @@ class biwriter {
3060
2884
  /**
3061
2885
  * Bit field writer
3062
2886
  *
3063
- * Note: When returning to a byte read, remaining bits are dropped
2887
+ * Note: When returning to a byte write, remaining bits are dropped
3064
2888
  *
3065
2889
  * @param {number} value - value as int
3066
2890
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3073,7 +2897,7 @@ class biwriter {
3073
2897
  /**
3074
2898
  * Bit field writer
3075
2899
  *
3076
- * Note: When returning to a byte read, remaining bits are dropped
2900
+ * Note: When returning to a byte write, remaining bits are dropped
3077
2901
  *
3078
2902
  * @param {number} value - value as int
3079
2903
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3085,7 +2909,7 @@ class biwriter {
3085
2909
  /**
3086
2910
  * Bit field writer
3087
2911
  *
3088
- * Note: When returning to a byte read, remaining bits are dropped
2912
+ * Note: When returning to a byte write, remaining bits are dropped
3089
2913
  *
3090
2914
  * @param {number} value - value as int
3091
2915
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3098,7 +2922,7 @@ class biwriter {
3098
2922
  /**
3099
2923
  * Bit field writer
3100
2924
  *
3101
- * Note: When returning to a byte read, remaining bits are dropped
2925
+ * Note: When returning to a byte write, remaining bits are dropped
3102
2926
  *
3103
2927
  * @param {number} value - value as int
3104
2928
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3110,7 +2934,7 @@ class biwriter {
3110
2934
  /**
3111
2935
  * Bit field writer
3112
2936
  *
3113
- * Note: When returning to a byte read, remaining bits are dropped
2937
+ * Note: When returning to a byte write, remaining bits are dropped
3114
2938
  *
3115
2939
  * @param {number} value - value as int
3116
2940
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3123,7 +2947,7 @@ class biwriter {
3123
2947
  /**
3124
2948
  * Bit field writer
3125
2949
  *
3126
- * Note: When returning to a byte read, remaining bits are dropped
2950
+ * Note: When returning to a byte write, remaining bits are dropped
3127
2951
  *
3128
2952
  * @param {number} value - value as int
3129
2953
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3135,7 +2959,7 @@ class biwriter {
3135
2959
  /**
3136
2960
  * Bit field writer
3137
2961
  *
3138
- * Note: When returning to a byte read, remaining bits are dropped
2962
+ * Note: When returning to a byte write, remaining bits are dropped
3139
2963
  *
3140
2964
  * @param {number} value - value as int
3141
2965
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3148,7 +2972,7 @@ class biwriter {
3148
2972
  /**
3149
2973
  * Bit field writer
3150
2974
  *
3151
- * Note: When returning to a byte read, remaining bits are dropped
2975
+ * Note: When returning to a byte write, remaining bits are dropped
3152
2976
  *
3153
2977
  * @param {number} value - value as int
3154
2978
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3160,7 +2984,7 @@ class biwriter {
3160
2984
  /**
3161
2985
  * Bit field writer
3162
2986
  *
3163
- * Note: When returning to a byte read, remaining bits are dropped
2987
+ * Note: When returning to a byte write, remaining bits are dropped
3164
2988
  *
3165
2989
  * @param {number} value - value as int
3166
2990
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3173,7 +2997,7 @@ class biwriter {
3173
2997
  /**
3174
2998
  * Bit field writer
3175
2999
  *
3176
- * Note: When returning to a byte read, remaining bits are dropped
3000
+ * Note: When returning to a byte write, remaining bits are dropped
3177
3001
  *
3178
3002
  * @param {number} value - value as int
3179
3003
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3185,7 +3009,7 @@ class biwriter {
3185
3009
  /**
3186
3010
  * Bit field writer
3187
3011
  *
3188
- * Note: When returning to a byte read, remaining bits are dropped
3012
+ * Note: When returning to a byte write, remaining bits are dropped
3189
3013
  *
3190
3014
  * @param {number} value - value as int
3191
3015
  * @param {number} bits - number of bits to write
@@ -3199,7 +3023,7 @@ class biwriter {
3199
3023
  /**
3200
3024
  * Bit field writer
3201
3025
  *
3202
- * Note: When returning to a byte read, remaining bits are dropped
3026
+ * Note: When returning to a byte write, remaining bits are dropped
3203
3027
  *
3204
3028
  * @param {number} value - value as int
3205
3029
  * @param {number} bits - number of bits to write
@@ -3213,7 +3037,7 @@ class biwriter {
3213
3037
  /**
3214
3038
  * Bit field writer
3215
3039
  *
3216
- * Note: When returning to a byte read, remaining bits are dropped
3040
+ * Note: When returning to a byte write, remaining bits are dropped
3217
3041
  *
3218
3042
  * @param {number} value - value as int
3219
3043
  * @param {number} bits - number of bits to write
@@ -3227,7 +3051,7 @@ class biwriter {
3227
3051
  /**
3228
3052
  * Bit field writer
3229
3053
  *
3230
- * Note: When returning to a byte read, remaining bits are dropped
3054
+ * Note: When returning to a byte write, remaining bits are dropped
3231
3055
  *
3232
3056
  * @param {number} value - value as int
3233
3057
  * @param {number} bits - number of bits to write
@@ -4368,7 +4192,7 @@ class biwriter {
4368
4192
  return this.writeInt64(value, offset, true, "big");
4369
4193
  }
4370
4194
  //
4371
- //doublefloat reader
4195
+ //doublefloat
4372
4196
  //
4373
4197
  /**
4374
4198
  * Writes double float
@@ -4574,7 +4398,7 @@ class biwriter {
4574
4398
  }
4575
4399
  else {
4576
4400
  this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4577
- throw new Error("Invalid length read size: " + lengthWriteSize);
4401
+ throw new Error("Invalid length write size: " + lengthWriteSize);
4578
4402
  }
4579
4403
  if (string.length > maxLength || (length || 0) > maxLength) {
4580
4404
  this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
@@ -4616,7 +4440,7 @@ class biwriter {
4616
4440
  this.offset += totalLength;
4617
4441
  }
4618
4442
  else {
4619
- throw new Error('Unsupported string type.');
4443
+ throw new Error('Unsupported string type: ' + stringType);
4620
4444
  }
4621
4445
  }
4622
4446
  /**