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,11 +1,12 @@
1
+ import { skip, goto, remove, checkSize, addData, hexDump } from './common';
1
2
  /**
2
3
  * Binary writer, includes bitfields and strings
3
4
  *
4
5
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
5
- * @param {number} byteOffset - byte offset to start writer, default is 0
6
- * @param {number} bitOffset - bit offset to start writer, 0-7
7
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
8
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
6
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
7
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
8
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
9
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
9
10
  */
10
11
  export class biwriter {
11
12
  isBuffer(obj) {
@@ -18,44 +19,25 @@ export class biwriter {
18
19
  if ((typeof Buffer !== 'undefined' && this.data instanceof Buffer)) {
19
20
  var paddbuffer = Buffer.alloc(to_padd);
20
21
  this.data = Buffer.concat([this.data, paddbuffer]);
22
+ this.size = this.data.length;
21
23
  }
22
24
  else {
23
25
  const addArray = new Array(to_padd);
24
26
  this.data = new Uint8Array([...this.data, ...addArray]);
27
+ this.size = this.data.length;
25
28
  }
26
29
  }
27
30
  check_size(write_bytes, write_bit, offset) {
28
- const bits = (write_bit || 0) + this.bitoffset;
29
- var new_off = (offset || this.offset);
30
- var writesize = write_bytes || 0;
31
- if (bits != 0) {
32
- //add bits
33
- writesize += Math.ceil(bits / 8);
34
- }
35
- //if biger extend
36
- const needed_size = new_off + writesize;
37
- if (needed_size > this.size) {
38
- const dif = needed_size - this.size;
39
- if (this.strict == false) {
40
- this.extendArray(dif);
41
- }
42
- else {
43
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
44
- throw new Error(`Reader reached end of data: reading to ` + needed_size + " at " + this.offset + " of " + this.size);
45
- }
46
- this.size = this.data.length;
47
- }
48
- //start read location
49
- this.offset = new_off;
31
+ return checkSize(this, write_bytes || 0, write_bit || 0, offset || this.offset);
50
32
  }
51
33
  /**
52
34
  * Binary writer, includes bitfields and strings
53
35
  *
54
36
  * @param {Buffer|Uint8Array} data - ``Buffer`` or ``Uint8Array``. Always found in ``biwriter.data``
55
- * @param {number} byteOffset - byte offset to start writer, default is 0
56
- * @param {number} bitOffset - bit offset to start writer, 0-7
57
- * @param {string} endianness - endianness ``big`` or ``little`` (default little)
58
- * @param {boolean} strict - strict mode: if true does not extend supplied array on outside write (default false)
37
+ * @param {number} byteOffset - Byte offset to start writer, default is 0
38
+ * @param {number} bitOffset - Bit offset to start writer, 0-7
39
+ * @param {string} endianness - Endianness ``big`` or ``little`` (default little)
40
+ * @param {boolean} strict - Strict mode: if true does not extend supplied array on outside write (default false)
59
41
  */
60
42
  constructor(data, byteOffset, bitOffset, endianness, strict) {
61
43
  this.endian = "little";
@@ -95,7 +77,7 @@ export class biwriter {
95
77
  throw new Error("Data required");
96
78
  }
97
79
  else {
98
- if (!this.isBufferOrUint8Array(this.data)) {
80
+ if (!this.isBufferOrUint8Array(data)) {
99
81
  throw new Error("Write data must be Uint8Array or Buffer");
100
82
  }
101
83
  }
@@ -103,8 +85,7 @@ export class biwriter {
103
85
  this.size = this.data.length + ((bitOffset || 0) % 8);
104
86
  }
105
87
  /**
106
- *
107
- * Change endian, defaults to little
88
+ * Change endian (default little)
108
89
  *
109
90
  * Can be changed at any time, doesn't loose position
110
91
  *
@@ -120,170 +101,133 @@ export class biwriter {
120
101
  this.endian = endian;
121
102
  }
122
103
  /**
123
- *
124
104
  * Sets endian to big
105
+ *
125
106
  */
126
107
  bigEndian() {
127
108
  this.endianness("big");
128
109
  }
129
110
  /**
130
- *
131
111
  * Sets endian to big
112
+ *
132
113
  */
133
114
  big() {
134
115
  this.endianness("big");
135
116
  }
136
117
  /**
137
- *
138
118
  * Sets endian to big
119
+ *
139
120
  */
140
121
  be() {
141
122
  this.endianness("big");
142
123
  }
143
124
  /**
144
- *
145
125
  * Sets endian to little
126
+ *
146
127
  */
147
128
  littleEndian() {
148
129
  this.endianness("little");
149
130
  }
150
131
  /**
151
- *
152
132
  * Sets endian to little
133
+ *
153
134
  */
154
135
  little() {
155
136
  this.endianness("little");
156
137
  }
157
138
  /**
158
- *
159
139
  * Sets endian to little
140
+ *
160
141
  */
161
142
  le() {
162
143
  this.endianness("little");
163
144
  }
145
+ //
146
+ // move from current position
147
+ //
164
148
  /**
165
- * Move current write byte or bit position, will extend data if outside of current size
149
+ * Offset current byte or bit position
150
+ * Note: Will extend array if strict mode is off and outside of max size
166
151
  *
167
- * @param {number} bytes - bytes to skip
168
- * @param {number} bits - bits to skip (0-7)
152
+ * @param {number} bytes - Bytes to skip
153
+ * @param {number} bits - Bits to skip (0-7)
169
154
  */
170
155
  skip(bytes, bits) {
171
- this.check_size(bytes, bits);
172
- this.offset += (bytes || 0);
173
- this.bitoffset += (bits || 0) % 8;
156
+ return skip(this, bytes, bits);
174
157
  }
175
158
  /**
176
- * Move current write byte or bit position, will extend data if outside of current size
159
+ * Offset current byte or bit position
160
+ * Note: Will extend array if strict mode is off and outside of max size
177
161
  *
178
- * @param {number} bytes - bytes to skip
179
- * @param {number} bits - bits to skip (0-7)
162
+ * @param {number} bytes - Bytes to skip
163
+ * @param {number} bits - Bits to skip (0-7)
180
164
  */
181
- fskip(bytes, bits) {
182
- this.check_size(bytes, bits);
183
- this.offset += (bytes || 0);
184
- this.bitoffset += (bits || 0) % 8;
165
+ jump(bytes, bits) {
166
+ this.skip(bytes, bits);
185
167
  }
168
+ //
169
+ // directly set current position
170
+ //
186
171
  /**
187
- * Change current byte or bit write position, will extend data if outside of current size
172
+ * Change position directly to address
173
+ * Note: Will extend array if strict mode is off and outside of max size
188
174
  *
189
- * @param {number} byte - byte to jump to
190
- * @param {number} bit - bit to jump to (0-7)
175
+ * @param {number} byte - byte to set to
176
+ * @param {number} bit - bit to set to (0-7)
191
177
  */
192
178
  goto(byte, bit) {
193
- const new_size = (byte + Math.ceil((bit || 0) / 8));
194
- if (new_size > this.size && this.strict == false) {
195
- this.extendArray(new_size - this.size);
196
- }
197
- else {
198
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
199
- throw new Error("Outside of range of data: goto " + new_size + " of " + this.size);
200
- }
201
- this.offset = byte;
202
- this.bitoffset = (bit || 0) % 8;
179
+ return goto(this, byte, bit);
203
180
  }
204
181
  /**
205
- * Change current byte or bit write position, will extend data if outside of current size
182
+ * Change position directly to address
183
+ * Note: Will extend array if strict mode is off and outside of max size
206
184
  *
207
- * @param {number} byte - byte to jump to
208
- * @param {number} bit - bit to jump to (0-7)
185
+ * @param {number} byte - byte to set to
186
+ * @param {number} bit - bit to set to (0-7)
209
187
  */
210
188
  seek(byte, bit) {
211
189
  return this.goto(byte, bit);
212
190
  }
213
191
  /**
214
- * Change current byte or bit write position, will extend data if outside of current size
215
- *
216
- * @param {number} byte - byte to jump to
217
- * @param {number} bit - bit to jump to (0-7)
218
- */
219
- fseek(byte, bit) {
220
- return this.goto(byte, bit);
221
- }
222
- /**
223
- * Change current byte or bit write position, will extend data if outside of current size
192
+ * Change position directly to address
193
+ * Note: Will extend array if strict mode is off and outside of max size
224
194
  *
225
- * @param {number} byte - byte to jump to
226
- * @param {number} bit - bit to jump to (0-7)
227
- */
228
- jump(byte, bit) {
229
- return this.goto(byte, bit);
230
- }
231
- /**
232
- * Change current byte or bit write position, will extend data if outside of current size
233
- *
234
- * @param {number} byte - byte to jump to
235
- * @param {number} bit - bit to jump to (0-7)
195
+ * @param {number} byte - byte to set to
196
+ * @param {number} bit - bit to set to (0-7)
236
197
  */
237
198
  pointer(byte, bit) {
238
199
  return this.goto(byte, bit);
239
200
  }
240
201
  /**
241
- * Change current byte or bit write position, will extend data if outside of current size
202
+ * Change position directly to address
203
+ * Note: Will extend array if strict mode is off and outside of max size
242
204
  *
243
- * @param {number} byte - byte to jump to
244
- * @param {number} bit - bit to jump to (0-7)
205
+ * @param {number} byte - byte to set to
206
+ * @param {number} bit - bit to set to (0-7)
245
207
  */
246
208
  warp(byte, bit) {
247
209
  return this.goto(byte, bit);
248
210
  }
211
+ //
212
+ //go to start
213
+ //
249
214
  /**
250
- * Change current byte or bit write position, will extend data if outside of current size
251
- *
252
- * @param {number} byte - byte to jump to
253
- * @param {number} bit - bit to jump to (0-7)
254
- */
255
- fsetpos(byte, bit) {
256
- return this.goto(byte, bit);
257
- }
258
- /**
259
- * Set offset to start of file
215
+ * Set byte and bit position to start of data
260
216
  */
261
217
  rewind() {
262
218
  this.offset = 0;
263
219
  this.bitoffset = 0;
264
220
  }
265
221
  /**
266
- * Set offset to start of file
222
+ * Set byte and bit position to start of data
267
223
  */
268
224
  gotostart() {
269
225
  this.offset = 0;
270
226
  this.bitoffset = 0;
271
227
  }
272
- /**
273
- * Set offset to start of file
274
- */
275
- tostart() {
276
- this.offset = 0;
277
- this.bitoffset = 0;
278
- }
279
- /**
280
- * Get the current byte position
281
- *
282
- * @return {number} current byte position
283
- */
284
- ftell() {
285
- return this.offset;
286
- }
228
+ //
229
+ //get position
230
+ //
287
231
  /**
288
232
  * Get the current byte position
289
233
  *
@@ -297,7 +241,7 @@ export class biwriter {
297
241
  *
298
242
  * @return {number} current byte position
299
243
  */
300
- fgetpos() {
244
+ getOffset() {
301
245
  return this.offset;
302
246
  }
303
247
  /**
@@ -308,143 +252,201 @@ export class biwriter {
308
252
  saveOffset() {
309
253
  return this.offset;
310
254
  }
255
+ //
256
+ //strict mode change
257
+ //
311
258
  /**
312
- * Disallows extending array if writing outside of max size
259
+ * Disallows extending data if position is outside of max size
313
260
  */
314
261
  restrict() {
315
262
  this.strict = true;
316
263
  }
317
264
  /**
318
- * Allows extending array if writing outside of max size
265
+ * Allows extending data if position is outside of max size
319
266
  */
320
267
  unrestrict() {
321
268
  this.strict = false;
322
269
  }
270
+ //
271
+ //remove part of data
272
+ //
323
273
  /**
324
- * Truncates array from start to current position unless supplied
325
- * Note: Does not affect supplied data
326
- * Note: Will extend array if strict mode is off
327
- * @param {number} startOffset - Start location, default 0
328
- * @param {number} endOffset - end location, default current write position
329
- */
330
- clip(startOffset, endOffset) {
331
- if ((endOffset || this.offset) > this.size) {
332
- if (this.strict == false) {
333
- this.extendArray((endOffset || this.offset) - this.size);
334
- }
335
- else {
336
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
337
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
338
- }
339
- }
340
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
274
+ * Deletes part of data from start to current byte position unless supplied, returns removed
275
+ * Note: Errors in strict mode
276
+ *
277
+ * @param {number} startOffset - Start location (default 0)
278
+ * @param {number} endOffset - End location (default current position)
279
+ * @param {boolean} consume - Move position to end of removed data (default false)
280
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
281
+ */
282
+ delete(startOffset, endOffset, consume) {
283
+ return remove(this, startOffset || 0, endOffset || this.offset, consume || false, true);
341
284
  }
342
285
  /**
343
- * Truncates array from start to current position unless supplied
344
- * Note: Does not affect supplied data
345
- * Note: Will extend array if strict mode is off
346
- * @param {number} startOffset - Start location, default 0
347
- * @param {number} endOffset - end location, default current write position
348
- */
349
- crop(startOffset, endOffset) {
350
- if ((endOffset || this.offset) > this.size) {
351
- if (this.strict == false) {
352
- this.extendArray((endOffset || this.offset) - this.size);
353
- }
354
- else {
355
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
356
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
357
- }
358
- }
359
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
286
+ * Deletes part of data from start to current byte position unless supplied, returns removed
287
+ * Note: Errors in strict mode
288
+ *
289
+ * @param {number} startOffset - Start location (default 0)
290
+ * @param {number} endOffset - End location (default current position)
291
+ * @param {boolean} consume - Move position to end of removed data (default false)
292
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
293
+ */
294
+ clip(startOffset, endOffset, consume) {
295
+ return remove(this, startOffset || 0, endOffset || this.offset, consume || false, true);
360
296
  }
361
297
  /**
362
- * Truncates array from start to current position unless supplied
363
- * Note: Does not affect supplied data
364
- * Note: Will extend array if strict mode is off
365
- * @param {number} startOffset - Start location, default 0
366
- * @param {number} endOffset - end location, default current write position
367
- */
368
- truncate(startOffset, endOffset) {
369
- if ((endOffset || this.offset) > this.size) {
370
- if (this.strict == false) {
371
- this.extendArray((endOffset || this.offset) - this.size);
372
- }
373
- else {
374
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
375
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
376
- }
377
- }
378
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
298
+ * Deletes part of data from current byte position to supplied length, returns removed
299
+ * Note: Errors in strict mode
300
+ *
301
+ * @param {number} length - Length of data in bytes to remove
302
+ * @param {boolean} consume - Move position to end of removed data (default false)
303
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
304
+ */
305
+ crop(length, consume) {
306
+ return remove(this, this.offset, this.offset + (length || 0), consume || false, true);
379
307
  }
380
308
  /**
381
- * Truncates array from start to current position unless supplied
382
- * Note: Does not affect supplied data
383
- * Note: Will extend array if strict mode is off
384
- * @param {number} startOffset - Start location, default 0
385
- * @param {number} endOffset - end location, default current write position
386
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
309
+ * Deletes part of data from current position to supplied length, returns removed
310
+ * Note: Only works in strict mode
311
+ *
312
+ * @param {number} length - Length of data in bytes to remove
313
+ * @param {boolean} consume - Move position to end of removed data (default false)
314
+ * @returns {Buffer|Uint8Array} Removed data as ``Buffer`` or ``Uint8Array``
387
315
  */
388
- slice(startOffset, endOffset) {
389
- if ((endOffset || this.offset) > this.size) {
390
- if (this.strict == false) {
391
- this.extendArray((endOffset || this.offset) - this.size);
392
- }
393
- else {
394
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
395
- throw new Error("End offset outside of data: endOffset" + endOffset + " of " + this.size);
396
- }
397
- }
398
- return this.data.slice(Math.abs(startOffset || 0), endOffset || this.offset);
316
+ drop(length, consume) {
317
+ return remove(this, this.offset, this.offset + (length || 0), consume || false, true);
318
+ }
319
+ //
320
+ //copy out
321
+ //
322
+ /**
323
+ * Returns part of data from current byte position to end of data unless supplied
324
+ *
325
+ * @param {number} startOffset - Start location (default current position)
326
+ * @param {number} endOffset - End location (default end of data)
327
+ * @param {boolean} consume - Move position to end of lifted data (default false)
328
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
329
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
330
+ */
331
+ lift(startOffset, endOffset, consume, fillValue) {
332
+ return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
333
+ }
334
+ /**
335
+ * Returns part of data from current byte position to end of data unless supplied
336
+ *
337
+ * @param {number} startOffset - Start location (default current position)
338
+ * @param {number} endOffset - End location (default end of data)
339
+ * @param {boolean} consume - Move position to end of lifted data (default false)
340
+ * @param {number} fillValue - Byte value to to fill returned data (does NOT fill unless supplied)
341
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
342
+ */
343
+ fill(startOffset, endOffset, consume, fillValue) {
344
+ return remove(this, startOffset || this.offset, endOffset || this.size, consume || false, false, fillValue);
399
345
  }
400
346
  /**
401
- * Extract array from current position to length supplied
347
+ * Extract data from current position to length supplied
402
348
  * Note: Does not affect supplied data
403
- * Note: Will extend array if strict mode is off
404
- * @param {number} length - length of data to copy from current offset
405
- * @param {number} consume - moves offset to end of length
406
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
349
+ *
350
+ * @param {number} length - Length of data in bytes to copy from current offset
351
+ * @param {number} consume - Moves offset to end of length
352
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
407
353
  */
408
354
  extract(length, consume) {
409
- if (this.offset + (length || 0) > this.size) {
410
- if (this.strict == false) {
411
- this.extendArray(this.offset + (length || 0) - this.size);
412
- }
413
- else {
414
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
415
- throw new Error("End offset outside of data: at " + this.offset + " reading " + length + " of" + this.size);
416
- }
417
- }
418
- const extract = this.data.slice(this.offset, this.offset + (length || 0));
419
- if (consume) {
420
- this.offset += length;
421
- }
422
- return extract;
355
+ return remove(this, this.offset, length || 0, consume || false, false);
423
356
  }
424
357
  /**
425
- * Extract array from current position to length supplied
358
+ * Extract data from current position to length supplied
426
359
  * Note: Does not affect supplied data
427
- * Note: Will extend array if strict mode is off
428
- * @param {number} length - length of data to copy from current offset
429
- * @param {number} consume - moves offset to end of length
430
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
360
+ *
361
+ * @param {number} length - Length of data in bytes to copy from current offset
362
+ * @param {number} consume - Moves offset to end of length
363
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
431
364
  */
432
- wrap(length, consume) {
433
- return this.extract(length, consume);
365
+ slice(length, consume) {
366
+ return remove(this, this.offset, length || 0, consume || false, false);
434
367
  }
435
368
  /**
436
- * Extract array from current position to length supplied
369
+ * Extract data from current position to length supplied
437
370
  * Note: Does not affect supplied data
438
- * Note: Will extend array if strict mode is off
439
- * @param {number} length - length of data to copy from current offset
440
- * @param {number} consume - moves offset to end of length
441
- * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
371
+ *
372
+ * @param {number} length - Length of data in bytes to copy from current offset
373
+ * @param {number} consume - Moves offset to end of length
374
+ * @returns {Buffer|Uint8Array} Selected data as ```Uint8Array``` or ```Buffer```
375
+ */
376
+ wrap(length, consume) {
377
+ return remove(this, this.offset, length || 0, consume || false, false);
378
+ }
379
+ //
380
+ //insert
381
+ //
382
+ /**
383
+ * Inserts data into data
384
+ * Note: Must be same data type as supplied data. Errors on strict mode.
385
+ *
386
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
387
+ * @param {boolean} consume - Move current write position to end of data (default false)
388
+ * @param {number} offset - Offset to add it at (defaults to current position)
389
+ */
390
+ insert(data, consume, offset) {
391
+ return addData(this, data, consume || false, offset || this.offset);
392
+ }
393
+ /**
394
+ * Inserts data into data
395
+ * Note: Must be same data type as supplied data. Errors on strict mode.
396
+ *
397
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
398
+ * @param {boolean} consume - Move current write position to end of data (default false)
399
+ * @param {number} offset - Offset to add it at (defaults to current position)
400
+ */
401
+ place(data, consume, offset) {
402
+ return addData(this, data, consume || false, offset || this.offset);
403
+ }
404
+ /**
405
+ * Adds data to start of supplied data
406
+ * Note: Must be same data type as supplied data. Errors on strict mode.
407
+ *
408
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
409
+ * @param {boolean} consume - Move current write position to end of data (default false)
410
+ */
411
+ unshift(data, consume) {
412
+ return addData(this, data, consume || false, 0);
413
+ }
414
+ /**
415
+ * Adds data to start of supplied data
416
+ * Note: Must be same data type as supplied data. Errors on strict mode.
417
+ *
418
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
419
+ * @param {boolean} consume - Move current write position to end of data (default false)
420
+ */
421
+ prepend(data, consume) {
422
+ return addData(this, data, consume || false, 0);
423
+ }
424
+ /**
425
+ * Adds data to end of supplied data
426
+ * Note: Must be same data type as supplied data. Errors on strict mode.
427
+ *
428
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
429
+ * @param {boolean} consume - Move current write position to end of data (default false)
430
+ */
431
+ push(data, consume) {
432
+ return addData(this, data, consume || false, this.size);
433
+ }
434
+ /**
435
+ * Adds data to end of supplied data
436
+ * Note: Must be same data type as supplied data. Errors on strict mode.
437
+ *
438
+ * @param {Buffer|Uint8Array} data - ```Uint8Array``` or ```Buffer``` to add to data
439
+ * @param {boolean} consume - Move current write position to end of data (default false)
442
440
  */
443
- lift(length, consume) {
444
- return this.extract(length, consume);
441
+ append(data, consume) {
442
+ return addData(this, data, consume || false, this.size);
445
443
  }
444
+ //
445
+ //finishing
446
+ //
446
447
  /**
447
448
  * Returns current data
449
+ *
448
450
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
449
451
  */
450
452
  get() {
@@ -452,48 +454,37 @@ export class biwriter {
452
454
  }
453
455
  /**
454
456
  * Returns current data
457
+ *
455
458
  * @returns {Buffer|Uint8Array} ``Buffer`` or ``Uint8Array``
456
459
  */
457
460
  return() {
458
461
  return this.data;
459
462
  }
460
463
  /**
461
- * removes writing data
464
+ * removes data
462
465
  */
463
466
  end() {
464
467
  this.data = undefined;
465
468
  }
466
469
  /**
467
- * removes writing data
470
+ * removes data
468
471
  */
469
472
  close() {
470
473
  this.data = undefined;
471
474
  }
472
475
  /**
473
- * removes writing data
476
+ * removes data
474
477
  */
475
478
  done() {
476
479
  this.data = undefined;
477
480
  }
478
481
  /**
479
- * removes writing data
482
+ * removes data
480
483
  */
481
484
  finished() {
482
485
  this.data = undefined;
483
486
  }
484
487
  /**
485
- * Turn hexdump on error off, default on
486
- */
487
- errorDumpOff() {
488
- this.errorDump = false;
489
- }
490
- /**
491
- * Turn hexdump on error on, default on
492
- */
493
- errorDumpOn() {
494
- this.errorDump = true;
495
- }
496
- /**
497
488
  * Console logs data as hex dump
498
489
  *
499
490
  * @param {object} options - options object
@@ -506,186 +497,19 @@ export class biwriter {
506
497
  * ```
507
498
  */
508
499
  hexdump(options) {
509
- var length = options && options.length;
510
- var startByte = options && options.startByte;
511
- var supressUnicode = options && options.supressUnicode || false;
512
- if ((startByte || 0) > this.size) {
513
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
514
- throw new Error("Hexdump start is outside of data size: " + startByte + " of " + this.size);
515
- }
516
- const start = startByte || this.offset;
517
- const end = Math.min(start + (length || 192), this.size);
518
- if (start + (length || 0) > this.size) {
519
- this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
520
- throw new Error("Hexdump amount is outside of data size: " + (start + (length || 0)) + " of " + end);
521
- }
522
- function hex_check(byte, bits) {
523
- var value = 0;
524
- for (var i = 0; i < bits;) {
525
- var remaining = bits - i;
526
- var bitOffset = 0;
527
- var currentByte = byte;
528
- var read = Math.min(remaining, 8 - bitOffset);
529
- var mask, readBits;
530
- mask = ~(0xFF << read);
531
- readBits = (currentByte >> (8 - read - bitOffset)) & mask;
532
- value <<= read;
533
- value |= readBits;
534
- i += read;
535
- }
536
- value = value >>> 0;
537
- return value;
538
- }
539
- const rows = [];
540
- var header = " 0 1 2 3 4 5 6 7 8 9 A B C D E F ";
541
- var ending = "0123456789ABCDEF";
542
- var addr = "";
543
- for (let i = start; i < end; i += 16) {
544
- addr = i.toString(16).padStart(5, '0');
545
- var row = this.data?.slice(i, i + 16) || [];
546
- var hex = Array.from(row, (byte) => byte.toString(16).padStart(2, '0')).join(' ');
547
- rows.push(`${addr} ${hex.padEnd(47)} `);
548
- }
549
- let result = '';
550
- let make_wide = false;
551
- let i = start;
552
- while (i < end) {
553
- const byte = this.data[i];
554
- if (byte < 32 || byte == 127) {
555
- result += '.';
556
- }
557
- else if (byte < 127) {
558
- // Valid UTF-8 start byte or single-byte character
559
- // Convert the byte to a character and add it to the result
560
- result += String.fromCharCode(byte);
561
- }
562
- else if (supressUnicode) {
563
- result += '.';
564
- }
565
- else if (hex_check(byte, 1) == 0) {
566
- //Byte 1
567
- result += String.fromCharCode(byte);
568
- }
569
- else if (hex_check(byte, 3) == 6) {
570
- //Byte 2
571
- if (i + 1 <= end) {
572
- //check second byte
573
- const byte2 = this.data[i + 1];
574
- if (hex_check(byte2, 2) == 2) {
575
- const charCode = ((byte & 0x1f) << 6) | (byte2 & 0x3f);
576
- i++;
577
- make_wide = true;
578
- const read = " " + String.fromCharCode(charCode);
579
- result += read;
580
- }
581
- else {
582
- result += ".";
583
- }
584
- }
585
- else {
586
- result += ".";
587
- }
588
- }
589
- else if (hex_check(byte, 4) == 14) {
590
- //Byte 3
591
- if (i + 1 <= end) {
592
- //check second byte
593
- const byte2 = this.data[i + 1];
594
- if (hex_check(byte2, 2) == 2) {
595
- if (i + 2 <= end) {
596
- //check third byte
597
- const byte3 = this.data[i + 2];
598
- if (hex_check(byte3, 2) == 2) {
599
- const charCode = ((byte & 0x0f) << 12) |
600
- ((byte2 & 0x3f) << 6) |
601
- (byte3 & 0x3f);
602
- i += 2;
603
- make_wide = true;
604
- const read = " " + String.fromCharCode(charCode);
605
- result += read;
606
- }
607
- else {
608
- i++;
609
- result += " .";
610
- }
611
- }
612
- else {
613
- i++;
614
- result += " .";
615
- }
616
- }
617
- else {
618
- result += ".";
619
- }
620
- }
621
- else {
622
- result += ".";
623
- }
624
- }
625
- else if (hex_check(byte, 5) == 28) {
626
- //Byte 4
627
- if (i + 1 <= end) {
628
- //check second byte
629
- const byte2 = this.data[i + 1];
630
- if (hex_check(byte2, 2) == 2) {
631
- if (i + 2 <= end) {
632
- //check third byte
633
- const byte3 = this.data[i + 2];
634
- if (hex_check(byte3, 2) == 2) {
635
- if (i + 3 <= end) {
636
- //check fourth byte
637
- const byte4 = this.data[i + 2];
638
- if (hex_check(byte4, 2) == 2) {
639
- const charCode = (((byte4 & 0xFF) << 24) | ((byte3 & 0xFF) << 16) | ((byte2 & 0xFF) << 8) | (byte & 0xFF));
640
- i += 3;
641
- make_wide = true;
642
- const read = " " + String.fromCharCode(charCode);
643
- result += read;
644
- }
645
- else {
646
- i += 2;
647
- result += " .";
648
- }
649
- }
650
- else {
651
- i += 2;
652
- result += " .";
653
- }
654
- }
655
- else {
656
- i++;
657
- result += " .";
658
- }
659
- }
660
- else {
661
- i++;
662
- result += " .";
663
- }
664
- }
665
- else {
666
- result += ".";
667
- }
668
- }
669
- else {
670
- result += ".";
671
- }
672
- }
673
- else {
674
- // Invalid UTF-8 byte, add a period to the result
675
- result += '.';
676
- }
677
- i++;
678
- }
679
- const chunks = result.match(new RegExp(`.{1,${16}}`, 'g'));
680
- chunks?.forEach((self, i) => {
681
- rows[i] = rows[i] + (make_wide ? "|" + self + "|" : self);
682
- });
683
- header = "".padStart(addr.length) + header + (make_wide ? "" : ending);
684
- rows.unshift(header);
685
- if (make_wide) {
686
- rows.push("*Removed character byte header on unicode detection");
687
- }
688
- console.log(rows.join("\n"));
500
+ return hexDump(this, options);
501
+ }
502
+ /**
503
+ * Turn hexdump on error off (default on)
504
+ */
505
+ errorDumpOff() {
506
+ this.errorDump = false;
507
+ }
508
+ /**
509
+ * Turn hexdump on error on (default on)
510
+ */
511
+ errorDumpOn() {
512
+ this.errorDump = true;
689
513
  }
690
514
  //
691
515
  //bit writer
@@ -780,22 +604,22 @@ export class biwriter {
780
604
  return this.writeBit(value, bits, offsetBits, offsetBytes, unsigned, endian);
781
605
  }
782
606
  /**
783
- * Bit field writer
784
- *
785
- * Note: When returning to a byte read, remaining bits are dropped
786
- *
787
- * @param {number} value - value as int
788
- * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
789
- * @param {number} offsetBytes - byte offset to start the write (default last write position)
790
- * @param {boolean} unsigned - if value is unsigned or not
791
- */
607
+ * Bit field writer
608
+ *
609
+ * Note: When returning to a byte write, remaining bits are dropped
610
+ *
611
+ * @param {number} value - value as int
612
+ * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
613
+ * @param {number} offsetBytes - byte offset to start the write (default last write position)
614
+ * @param {boolean} unsigned - if value is unsigned or not
615
+ */
792
616
  bit1(value, offsetBits, offsetBytes, unsigned) {
793
617
  return this.bit(value, 1, offsetBits, offsetBytes, unsigned);
794
618
  }
795
619
  /**
796
620
  * Bit field writer
797
621
  *
798
- * Note: When returning to a byte read, remaining bits are dropped
622
+ * Note: When returning to a byte write, remaining bits are dropped
799
623
  *
800
624
  * @param {number} value - value as int
801
625
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -807,7 +631,7 @@ export class biwriter {
807
631
  /**
808
632
  * Bit field writer
809
633
  *
810
- * Note: When returning to a byte read, remaining bits are dropped
634
+ * Note: When returning to a byte write, remaining bits are dropped
811
635
  *
812
636
  * @param {number} value - value as int
813
637
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -820,7 +644,7 @@ export class biwriter {
820
644
  /**
821
645
  * Bit field writer
822
646
  *
823
- * Note: When returning to a byte read, remaining bits are dropped
647
+ * Note: When returning to a byte write, remaining bits are dropped
824
648
  *
825
649
  * @param {number} value - value as int
826
650
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -832,7 +656,7 @@ export class biwriter {
832
656
  /**
833
657
  * Bit field writer
834
658
  *
835
- * Note: When returning to a byte read, remaining bits are dropped
659
+ * Note: When returning to a byte write, remaining bits are dropped
836
660
  *
837
661
  * @param {number} value - value as int
838
662
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -845,7 +669,7 @@ export class biwriter {
845
669
  /**
846
670
  * Bit field writer
847
671
  *
848
- * Note: When returning to a byte read, remaining bits are dropped
672
+ * Note: When returning to a byte write, remaining bits are dropped
849
673
  *
850
674
  * @param {number} value - value as int
851
675
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -857,7 +681,7 @@ export class biwriter {
857
681
  /**
858
682
  * Bit field writer
859
683
  *
860
- * Note: When returning to a byte read, remaining bits are dropped
684
+ * Note: When returning to a byte write, remaining bits are dropped
861
685
  *
862
686
  * @param {number} value - value as int
863
687
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -870,7 +694,7 @@ export class biwriter {
870
694
  /**
871
695
  * Bit field writer
872
696
  *
873
- * Note: When returning to a byte read, remaining bits are dropped
697
+ * Note: When returning to a byte write, remaining bits are dropped
874
698
  *
875
699
  * @param {number} value - value as int
876
700
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -882,7 +706,7 @@ export class biwriter {
882
706
  /**
883
707
  * Bit field writer
884
708
  *
885
- * Note: When returning to a byte read, remaining bits are dropped
709
+ * Note: When returning to a byte write, remaining bits are dropped
886
710
  *
887
711
  * @param {number} value - value as int
888
712
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -895,7 +719,7 @@ export class biwriter {
895
719
  /**
896
720
  * Bit field writer
897
721
  *
898
- * Note: When returning to a byte read, remaining bits are dropped
722
+ * Note: When returning to a byte write, remaining bits are dropped
899
723
  *
900
724
  * @param {number} value - value as int
901
725
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -907,7 +731,7 @@ export class biwriter {
907
731
  /**
908
732
  * Bit field writer
909
733
  *
910
- * Note: When returning to a byte read, remaining bits are dropped
734
+ * Note: When returning to a byte write, remaining bits are dropped
911
735
  *
912
736
  * @param {number} value - value as int
913
737
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -920,7 +744,7 @@ export class biwriter {
920
744
  /**
921
745
  * Bit field writer
922
746
  *
923
- * Note: When returning to a byte read, remaining bits are dropped
747
+ * Note: When returning to a byte write, remaining bits are dropped
924
748
  *
925
749
  * @param {number} value - value as int
926
750
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -932,7 +756,7 @@ export class biwriter {
932
756
  /**
933
757
  * Bit field writer
934
758
  *
935
- * Note: When returning to a byte read, remaining bits are dropped
759
+ * Note: When returning to a byte write, remaining bits are dropped
936
760
  *
937
761
  * @param {number} value - value as int
938
762
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -945,7 +769,7 @@ export class biwriter {
945
769
  /**
946
770
  * Bit field writer
947
771
  *
948
- * Note: When returning to a byte read, remaining bits are dropped
772
+ * Note: When returning to a byte write, remaining bits are dropped
949
773
  *
950
774
  * @param {number} value - value as int
951
775
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -957,7 +781,7 @@ export class biwriter {
957
781
  /**
958
782
  * Bit field writer
959
783
  *
960
- * Note: When returning to a byte read, remaining bits are dropped
784
+ * Note: When returning to a byte write, remaining bits are dropped
961
785
  *
962
786
  * @param {number} value - value as int
963
787
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -970,7 +794,7 @@ export class biwriter {
970
794
  /**
971
795
  * Bit field writer
972
796
  *
973
- * Note: When returning to a byte read, remaining bits are dropped
797
+ * Note: When returning to a byte write, remaining bits are dropped
974
798
  *
975
799
  * @param {number} value - value as int
976
800
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -982,7 +806,7 @@ export class biwriter {
982
806
  /**
983
807
  * Bit field writer
984
808
  *
985
- * Note: When returning to a byte read, remaining bits are dropped
809
+ * Note: When returning to a byte write, remaining bits are dropped
986
810
  *
987
811
  * @param {number} value - value as int
988
812
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -995,7 +819,7 @@ export class biwriter {
995
819
  /**
996
820
  * Bit field writer
997
821
  *
998
- * Note: When returning to a byte read, remaining bits are dropped
822
+ * Note: When returning to a byte write, remaining bits are dropped
999
823
  *
1000
824
  * @param {number} value - value as int
1001
825
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1007,7 +831,7 @@ export class biwriter {
1007
831
  /**
1008
832
  * Bit field writer
1009
833
  *
1010
- * Note: When returning to a byte read, remaining bits are dropped
834
+ * Note: When returning to a byte write, remaining bits are dropped
1011
835
  *
1012
836
  * @param {number} value - value as int
1013
837
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1020,7 +844,7 @@ export class biwriter {
1020
844
  /**
1021
845
  * Bit field writer
1022
846
  *
1023
- * Note: When returning to a byte read, remaining bits are dropped
847
+ * Note: When returning to a byte write, remaining bits are dropped
1024
848
  *
1025
849
  * @param {number} value - value as int
1026
850
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1032,7 +856,7 @@ export class biwriter {
1032
856
  /**
1033
857
  * Bit field writer
1034
858
  *
1035
- * Note: When returning to a byte read, remaining bits are dropped
859
+ * Note: When returning to a byte write, remaining bits are dropped
1036
860
  *
1037
861
  * @param {number} value - value as int
1038
862
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1045,7 +869,7 @@ export class biwriter {
1045
869
  /**
1046
870
  * Bit field writer
1047
871
  *
1048
- * Note: When returning to a byte read, remaining bits are dropped
872
+ * Note: When returning to a byte write, remaining bits are dropped
1049
873
  *
1050
874
  * @param {number} value - value as int
1051
875
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1057,7 +881,7 @@ export class biwriter {
1057
881
  /**
1058
882
  * Bit field writer
1059
883
  *
1060
- * Note: When returning to a byte read, remaining bits are dropped
884
+ * Note: When returning to a byte write, remaining bits are dropped
1061
885
  *
1062
886
  * @param {number} value - value as int
1063
887
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1070,7 +894,7 @@ export class biwriter {
1070
894
  /**
1071
895
  * Bit field writer
1072
896
  *
1073
- * Note: When returning to a byte read, remaining bits are dropped
897
+ * Note: When returning to a byte write, remaining bits are dropped
1074
898
  *
1075
899
  * @param {number} value - value as int
1076
900
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1082,7 +906,7 @@ export class biwriter {
1082
906
  /**
1083
907
  * Bit field writer
1084
908
  *
1085
- * Note: When returning to a byte read, remaining bits are dropped
909
+ * Note: When returning to a byte write, remaining bits are dropped
1086
910
  *
1087
911
  * @param {number} value - value as int
1088
912
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1095,7 +919,7 @@ export class biwriter {
1095
919
  /**
1096
920
  * Bit field writer
1097
921
  *
1098
- * Note: When returning to a byte read, remaining bits are dropped
922
+ * Note: When returning to a byte write, remaining bits are dropped
1099
923
  *
1100
924
  * @param {number} value - value as int
1101
925
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1107,7 +931,7 @@ export class biwriter {
1107
931
  /**
1108
932
  * Bit field writer
1109
933
  *
1110
- * Note: When returning to a byte read, remaining bits are dropped
934
+ * Note: When returning to a byte write, remaining bits are dropped
1111
935
  *
1112
936
  * @param {number} value - value as int
1113
937
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1120,7 +944,7 @@ export class biwriter {
1120
944
  /**
1121
945
  * Bit field writer
1122
946
  *
1123
- * Note: When returning to a byte read, remaining bits are dropped
947
+ * Note: When returning to a byte write, remaining bits are dropped
1124
948
  *
1125
949
  * @param {number} value - value as int
1126
950
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1132,7 +956,7 @@ export class biwriter {
1132
956
  /**
1133
957
  * Bit field writer
1134
958
  *
1135
- * Note: When returning to a byte read, remaining bits are dropped
959
+ * Note: When returning to a byte write, remaining bits are dropped
1136
960
  *
1137
961
  * @param {number} value - value as int
1138
962
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1145,7 +969,7 @@ export class biwriter {
1145
969
  /**
1146
970
  * Bit field writer
1147
971
  *
1148
- * Note: When returning to a byte read, remaining bits are dropped
972
+ * Note: When returning to a byte write, remaining bits are dropped
1149
973
  *
1150
974
  * @param {number} value - value as int
1151
975
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1157,7 +981,7 @@ export class biwriter {
1157
981
  /**
1158
982
  * Bit field writer
1159
983
  *
1160
- * Note: When returning to a byte read, remaining bits are dropped
984
+ * Note: When returning to a byte write, remaining bits are dropped
1161
985
  *
1162
986
  * @param {number} value - value as int
1163
987
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1170,7 +994,7 @@ export class biwriter {
1170
994
  /**
1171
995
  * Bit field writer
1172
996
  *
1173
- * Note: When returning to a byte read, remaining bits are dropped
997
+ * Note: When returning to a byte write, remaining bits are dropped
1174
998
  *
1175
999
  * @param {number} value - value as int
1176
1000
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1182,7 +1006,7 @@ export class biwriter {
1182
1006
  /**
1183
1007
  * Bit field writer
1184
1008
  *
1185
- * Note: When returning to a byte read, remaining bits are dropped
1009
+ * Note: When returning to a byte write, remaining bits are dropped
1186
1010
  *
1187
1011
  * @param {number} value - value as int
1188
1012
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1195,7 +1019,7 @@ export class biwriter {
1195
1019
  /**
1196
1020
  * Bit field writer
1197
1021
  *
1198
- * Note: When returning to a byte read, remaining bits are dropped
1022
+ * Note: When returning to a byte write, remaining bits are dropped
1199
1023
  *
1200
1024
  * @param {number} value - value as int
1201
1025
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1207,7 +1031,7 @@ export class biwriter {
1207
1031
  /**
1208
1032
  * Bit field writer
1209
1033
  *
1210
- * Note: When returning to a byte read, remaining bits are dropped
1034
+ * Note: When returning to a byte write, remaining bits are dropped
1211
1035
  *
1212
1036
  * @param {number} value - value as int
1213
1037
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1220,7 +1044,7 @@ export class biwriter {
1220
1044
  /**
1221
1045
  * Bit field writer
1222
1046
  *
1223
- * Note: When returning to a byte read, remaining bits are dropped
1047
+ * Note: When returning to a byte write, remaining bits are dropped
1224
1048
  *
1225
1049
  * @param {number} value - value as int
1226
1050
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1232,7 +1056,7 @@ export class biwriter {
1232
1056
  /**
1233
1057
  * Bit field writer
1234
1058
  *
1235
- * Note: When returning to a byte read, remaining bits are dropped
1059
+ * Note: When returning to a byte write, remaining bits are dropped
1236
1060
  *
1237
1061
  * @param {number} value - value as int
1238
1062
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1245,7 +1069,7 @@ export class biwriter {
1245
1069
  /**
1246
1070
  * Bit field writer
1247
1071
  *
1248
- * Note: When returning to a byte read, remaining bits are dropped
1072
+ * Note: When returning to a byte write, remaining bits are dropped
1249
1073
  *
1250
1074
  * @param {number} value - value as int
1251
1075
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1257,7 +1081,7 @@ export class biwriter {
1257
1081
  /**
1258
1082
  * Bit field writer
1259
1083
  *
1260
- * Note: When returning to a byte read, remaining bits are dropped
1084
+ * Note: When returning to a byte write, remaining bits are dropped
1261
1085
  *
1262
1086
  * @param {number} value - value as int
1263
1087
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1270,7 +1094,7 @@ export class biwriter {
1270
1094
  /**
1271
1095
  * Bit field writer
1272
1096
  *
1273
- * Note: When returning to a byte read, remaining bits are dropped
1097
+ * Note: When returning to a byte write, remaining bits are dropped
1274
1098
  *
1275
1099
  * @param {number} value - value as int
1276
1100
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1282,7 +1106,7 @@ export class biwriter {
1282
1106
  /**
1283
1107
  * Bit field writer
1284
1108
  *
1285
- * Note: When returning to a byte read, remaining bits are dropped
1109
+ * Note: When returning to a byte write, remaining bits are dropped
1286
1110
  *
1287
1111
  * @param {number} value - value as int
1288
1112
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1295,7 +1119,7 @@ export class biwriter {
1295
1119
  /**
1296
1120
  * Bit field writer
1297
1121
  *
1298
- * Note: When returning to a byte read, remaining bits are dropped
1122
+ * Note: When returning to a byte write, remaining bits are dropped
1299
1123
  *
1300
1124
  * @param {number} value - value as int
1301
1125
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1307,7 +1131,7 @@ export class biwriter {
1307
1131
  /**
1308
1132
  * Bit field writer
1309
1133
  *
1310
- * Note: When returning to a byte read, remaining bits are dropped
1134
+ * Note: When returning to a byte write, remaining bits are dropped
1311
1135
  *
1312
1136
  * @param {number} value - value as int
1313
1137
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1320,7 +1144,7 @@ export class biwriter {
1320
1144
  /**
1321
1145
  * Bit field writer
1322
1146
  *
1323
- * Note: When returning to a byte read, remaining bits are dropped
1147
+ * Note: When returning to a byte write, remaining bits are dropped
1324
1148
  *
1325
1149
  * @param {number} value - value as int
1326
1150
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1332,7 +1156,7 @@ export class biwriter {
1332
1156
  /**
1333
1157
  * Bit field writer
1334
1158
  *
1335
- * Note: When returning to a byte read, remaining bits are dropped
1159
+ * Note: When returning to a byte write, remaining bits are dropped
1336
1160
  *
1337
1161
  * @param {number} value - value as int
1338
1162
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1345,7 +1169,7 @@ export class biwriter {
1345
1169
  /**
1346
1170
  * Bit field writer
1347
1171
  *
1348
- * Note: When returning to a byte read, remaining bits are dropped
1172
+ * Note: When returning to a byte write, remaining bits are dropped
1349
1173
  *
1350
1174
  * @param {number} value - value as int
1351
1175
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1357,7 +1181,7 @@ export class biwriter {
1357
1181
  /**
1358
1182
  * Bit field writer
1359
1183
  *
1360
- * Note: When returning to a byte read, remaining bits are dropped
1184
+ * Note: When returning to a byte write, remaining bits are dropped
1361
1185
  *
1362
1186
  * @param {number} value - value as int
1363
1187
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1370,7 +1194,7 @@ export class biwriter {
1370
1194
  /**
1371
1195
  * Bit field writer
1372
1196
  *
1373
- * Note: When returning to a byte read, remaining bits are dropped
1197
+ * Note: When returning to a byte write, remaining bits are dropped
1374
1198
  *
1375
1199
  * @param {number} value - value as int
1376
1200
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1382,7 +1206,7 @@ export class biwriter {
1382
1206
  /**
1383
1207
  * Bit field writer
1384
1208
  *
1385
- * Note: When returning to a byte read, remaining bits are dropped
1209
+ * Note: When returning to a byte write, remaining bits are dropped
1386
1210
  *
1387
1211
  * @param {number} value - value as int
1388
1212
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1395,7 +1219,7 @@ export class biwriter {
1395
1219
  /**
1396
1220
  * Bit field writer
1397
1221
  *
1398
- * Note: When returning to a byte read, remaining bits are dropped
1222
+ * Note: When returning to a byte write, remaining bits are dropped
1399
1223
  *
1400
1224
  * @param {number} value - value as int
1401
1225
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1407,7 +1231,7 @@ export class biwriter {
1407
1231
  /**
1408
1232
  * Bit field writer
1409
1233
  *
1410
- * Note: When returning to a byte read, remaining bits are dropped
1234
+ * Note: When returning to a byte write, remaining bits are dropped
1411
1235
  *
1412
1236
  * @param {number} value - value as int
1413
1237
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1420,7 +1244,7 @@ export class biwriter {
1420
1244
  /**
1421
1245
  * Bit field writer
1422
1246
  *
1423
- * Note: When returning to a byte read, remaining bits are dropped
1247
+ * Note: When returning to a byte write, remaining bits are dropped
1424
1248
  *
1425
1249
  * @param {number} value - value as int
1426
1250
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1432,7 +1256,7 @@ export class biwriter {
1432
1256
  /**
1433
1257
  * Bit field writer
1434
1258
  *
1435
- * Note: When returning to a byte read, remaining bits are dropped
1259
+ * Note: When returning to a byte write, remaining bits are dropped
1436
1260
  *
1437
1261
  * @param {number} value - value as int
1438
1262
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1445,7 +1269,7 @@ export class biwriter {
1445
1269
  /**
1446
1270
  * Bit field writer
1447
1271
  *
1448
- * Note: When returning to a byte read, remaining bits are dropped
1272
+ * Note: When returning to a byte write, remaining bits are dropped
1449
1273
  *
1450
1274
  * @param {number} value - value as int
1451
1275
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1457,7 +1281,7 @@ export class biwriter {
1457
1281
  /**
1458
1282
  * Bit field writer
1459
1283
  *
1460
- * Note: When returning to a byte read, remaining bits are dropped
1284
+ * Note: When returning to a byte write, remaining bits are dropped
1461
1285
  *
1462
1286
  * @param {number} value - value as int
1463
1287
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1470,7 +1294,7 @@ export class biwriter {
1470
1294
  /**
1471
1295
  * Bit field writer
1472
1296
  *
1473
- * Note: When returning to a byte read, remaining bits are dropped
1297
+ * Note: When returning to a byte write, remaining bits are dropped
1474
1298
  *
1475
1299
  * @param {number} value - value as int
1476
1300
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1482,7 +1306,7 @@ export class biwriter {
1482
1306
  /**
1483
1307
  * Bit field writer
1484
1308
  *
1485
- * Note: When returning to a byte read, remaining bits are dropped
1309
+ * Note: When returning to a byte write, remaining bits are dropped
1486
1310
  *
1487
1311
  * @param {number} value - value as int
1488
1312
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1495,7 +1319,7 @@ export class biwriter {
1495
1319
  /**
1496
1320
  * Bit field writer
1497
1321
  *
1498
- * Note: When returning to a byte read, remaining bits are dropped
1322
+ * Note: When returning to a byte write, remaining bits are dropped
1499
1323
  *
1500
1324
  * @param {number} value - value as int
1501
1325
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1507,7 +1331,7 @@ export class biwriter {
1507
1331
  /**
1508
1332
  * Bit field writer
1509
1333
  *
1510
- * Note: When returning to a byte read, remaining bits are dropped
1334
+ * Note: When returning to a byte write, remaining bits are dropped
1511
1335
  *
1512
1336
  * @param {number} value - value as int
1513
1337
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1520,7 +1344,7 @@ export class biwriter {
1520
1344
  /**
1521
1345
  * Bit field writer
1522
1346
  *
1523
- * Note: When returning to a byte read, remaining bits are dropped
1347
+ * Note: When returning to a byte write, remaining bits are dropped
1524
1348
  *
1525
1349
  * @param {number} value - value as int
1526
1350
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1532,7 +1356,7 @@ export class biwriter {
1532
1356
  /**
1533
1357
  * Bit field writer
1534
1358
  *
1535
- * Note: When returning to a byte read, remaining bits are dropped
1359
+ * Note: When returning to a byte write, remaining bits are dropped
1536
1360
  *
1537
1361
  * @param {number} value - value as int
1538
1362
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1545,7 +1369,7 @@ export class biwriter {
1545
1369
  /**
1546
1370
  * Bit field writer
1547
1371
  *
1548
- * Note: When returning to a byte read, remaining bits are dropped
1372
+ * Note: When returning to a byte write, remaining bits are dropped
1549
1373
  *
1550
1374
  * @param {number} value - value as int
1551
1375
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1557,7 +1381,7 @@ export class biwriter {
1557
1381
  /**
1558
1382
  * Bit field writer
1559
1383
  *
1560
- * Note: When returning to a byte read, remaining bits are dropped
1384
+ * Note: When returning to a byte write, remaining bits are dropped
1561
1385
  *
1562
1386
  * @param {number} value - value as int
1563
1387
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1570,7 +1394,7 @@ export class biwriter {
1570
1394
  /**
1571
1395
  * Bit field writer
1572
1396
  *
1573
- * Note: When returning to a byte read, remaining bits are dropped
1397
+ * Note: When returning to a byte write, remaining bits are dropped
1574
1398
  *
1575
1399
  * @param {number} value - value as int
1576
1400
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1582,7 +1406,7 @@ export class biwriter {
1582
1406
  /**
1583
1407
  * Bit field writer
1584
1408
  *
1585
- * Note: When returning to a byte read, remaining bits are dropped
1409
+ * Note: When returning to a byte write, remaining bits are dropped
1586
1410
  *
1587
1411
  * @param {number} value - value as int
1588
1412
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1595,7 +1419,7 @@ export class biwriter {
1595
1419
  /**
1596
1420
  * Bit field writer
1597
1421
  *
1598
- * Note: When returning to a byte read, remaining bits are dropped
1422
+ * Note: When returning to a byte write, remaining bits are dropped
1599
1423
  *
1600
1424
  * @param {number} value - value as int
1601
1425
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1607,7 +1431,7 @@ export class biwriter {
1607
1431
  /**
1608
1432
  * Bit field writer
1609
1433
  *
1610
- * Note: When returning to a byte read, remaining bits are dropped
1434
+ * Note: When returning to a byte write, remaining bits are dropped
1611
1435
  *
1612
1436
  * @param {number} value - value as int
1613
1437
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1620,7 +1444,7 @@ export class biwriter {
1620
1444
  /**
1621
1445
  * Bit field writer
1622
1446
  *
1623
- * Note: When returning to a byte read, remaining bits are dropped
1447
+ * Note: When returning to a byte write, remaining bits are dropped
1624
1448
  *
1625
1449
  * @param {number} value - value as int
1626
1450
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1632,7 +1456,7 @@ export class biwriter {
1632
1456
  /**
1633
1457
  * Bit field writer
1634
1458
  *
1635
- * Note: When returning to a byte read, remaining bits are dropped
1459
+ * Note: When returning to a byte write, remaining bits are dropped
1636
1460
  *
1637
1461
  * @param {number} value - value as int
1638
1462
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1645,7 +1469,7 @@ export class biwriter {
1645
1469
  /**
1646
1470
  * Bit field writer
1647
1471
  *
1648
- * Note: When returning to a byte read, remaining bits are dropped
1472
+ * Note: When returning to a byte write, remaining bits are dropped
1649
1473
  *
1650
1474
  * @param {number} value - value as int
1651
1475
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1657,7 +1481,7 @@ export class biwriter {
1657
1481
  /**
1658
1482
  * Bit field writer
1659
1483
  *
1660
- * Note: When returning to a byte read, remaining bits are dropped
1484
+ * Note: When returning to a byte write, remaining bits are dropped
1661
1485
  *
1662
1486
  * @param {number} value - value as int
1663
1487
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1670,7 +1494,7 @@ export class biwriter {
1670
1494
  /**
1671
1495
  * Bit field writer
1672
1496
  *
1673
- * Note: When returning to a byte read, remaining bits are dropped
1497
+ * Note: When returning to a byte write, remaining bits are dropped
1674
1498
  *
1675
1499
  * @param {number} value - value as int
1676
1500
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1682,7 +1506,7 @@ export class biwriter {
1682
1506
  /**
1683
1507
  * Bit field writer
1684
1508
  *
1685
- * Note: When returning to a byte read, remaining bits are dropped
1509
+ * Note: When returning to a byte write, remaining bits are dropped
1686
1510
  *
1687
1511
  * @param {number} value - value as int
1688
1512
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1695,7 +1519,7 @@ export class biwriter {
1695
1519
  /**
1696
1520
  * Bit field writer
1697
1521
  *
1698
- * Note: When returning to a byte read, remaining bits are dropped
1522
+ * Note: When returning to a byte write, remaining bits are dropped
1699
1523
  *
1700
1524
  * @param {number} value - value as int
1701
1525
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1707,7 +1531,7 @@ export class biwriter {
1707
1531
  /**
1708
1532
  * Bit field writer
1709
1533
  *
1710
- * Note: When returning to a byte read, remaining bits are dropped
1534
+ * Note: When returning to a byte write, remaining bits are dropped
1711
1535
  *
1712
1536
  * @param {number} value - value as int
1713
1537
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1720,7 +1544,7 @@ export class biwriter {
1720
1544
  /**
1721
1545
  * Bit field writer
1722
1546
  *
1723
- * Note: When returning to a byte read, remaining bits are dropped
1547
+ * Note: When returning to a byte write, remaining bits are dropped
1724
1548
  *
1725
1549
  * @param {number} value - value as int
1726
1550
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1732,7 +1556,7 @@ export class biwriter {
1732
1556
  /**
1733
1557
  * Bit field writer
1734
1558
  *
1735
- * Note: When returning to a byte read, remaining bits are dropped
1559
+ * Note: When returning to a byte write, remaining bits are dropped
1736
1560
  *
1737
1561
  * @param {number} value - value as int
1738
1562
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1745,7 +1569,7 @@ export class biwriter {
1745
1569
  /**
1746
1570
  * Bit field writer
1747
1571
  *
1748
- * Note: When returning to a byte read, remaining bits are dropped
1572
+ * Note: When returning to a byte write, remaining bits are dropped
1749
1573
  *
1750
1574
  * @param {number} value - value as int
1751
1575
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1757,7 +1581,7 @@ export class biwriter {
1757
1581
  /**
1758
1582
  * Bit field writer
1759
1583
  *
1760
- * Note: When returning to a byte read, remaining bits are dropped
1584
+ * Note: When returning to a byte write, remaining bits are dropped
1761
1585
  *
1762
1586
  * @param {number} value - value as int
1763
1587
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1770,7 +1594,7 @@ export class biwriter {
1770
1594
  /**
1771
1595
  * Bit field writer
1772
1596
  *
1773
- * Note: When returning to a byte read, remaining bits are dropped
1597
+ * Note: When returning to a byte write, remaining bits are dropped
1774
1598
  *
1775
1599
  * @param {number} value - value as int
1776
1600
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1782,7 +1606,7 @@ export class biwriter {
1782
1606
  /**
1783
1607
  * Bit field writer
1784
1608
  *
1785
- * Note: When returning to a byte read, remaining bits are dropped
1609
+ * Note: When returning to a byte write, remaining bits are dropped
1786
1610
  *
1787
1611
  * @param {number} value - value as int
1788
1612
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1795,7 +1619,7 @@ export class biwriter {
1795
1619
  /**
1796
1620
  * Bit field writer
1797
1621
  *
1798
- * Note: When returning to a byte read, remaining bits are dropped
1622
+ * Note: When returning to a byte write, remaining bits are dropped
1799
1623
  *
1800
1624
  * @param {number} value - value as int
1801
1625
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1807,7 +1631,7 @@ export class biwriter {
1807
1631
  /**
1808
1632
  * Bit field writer
1809
1633
  *
1810
- * Note: When returning to a byte read, remaining bits are dropped
1634
+ * Note: When returning to a byte write, remaining bits are dropped
1811
1635
  *
1812
1636
  * @param {number} value - value as int
1813
1637
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1820,7 +1644,7 @@ export class biwriter {
1820
1644
  /**
1821
1645
  * Bit field writer
1822
1646
  *
1823
- * Note: When returning to a byte read, remaining bits are dropped
1647
+ * Note: When returning to a byte write, remaining bits are dropped
1824
1648
  *
1825
1649
  * @param {number} value - value as int
1826
1650
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1832,7 +1656,7 @@ export class biwriter {
1832
1656
  /**
1833
1657
  * Bit field writer
1834
1658
  *
1835
- * Note: When returning to a byte read, remaining bits are dropped
1659
+ * Note: When returning to a byte write, remaining bits are dropped
1836
1660
  *
1837
1661
  * @param {number} value - value as int
1838
1662
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1845,7 +1669,7 @@ export class biwriter {
1845
1669
  /**
1846
1670
  * Bit field writer
1847
1671
  *
1848
- * Note: When returning to a byte read, remaining bits are dropped
1672
+ * Note: When returning to a byte write, remaining bits are dropped
1849
1673
  *
1850
1674
  * @param {number} value - value as int
1851
1675
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1857,7 +1681,7 @@ export class biwriter {
1857
1681
  /**
1858
1682
  * Bit field writer
1859
1683
  *
1860
- * Note: When returning to a byte read, remaining bits are dropped
1684
+ * Note: When returning to a byte write, remaining bits are dropped
1861
1685
  *
1862
1686
  * @param {number} value - value as int
1863
1687
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1870,7 +1694,7 @@ export class biwriter {
1870
1694
  /**
1871
1695
  * Bit field writer
1872
1696
  *
1873
- * Note: When returning to a byte read, remaining bits are dropped
1697
+ * Note: When returning to a byte write, remaining bits are dropped
1874
1698
  *
1875
1699
  * @param {number} value - value as int
1876
1700
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1882,7 +1706,7 @@ export class biwriter {
1882
1706
  /**
1883
1707
  * Bit field writer
1884
1708
  *
1885
- * Note: When returning to a byte read, remaining bits are dropped
1709
+ * Note: When returning to a byte write, remaining bits are dropped
1886
1710
  *
1887
1711
  * @param {number} value - value as int
1888
1712
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1895,7 +1719,7 @@ export class biwriter {
1895
1719
  /**
1896
1720
  * Bit field writer
1897
1721
  *
1898
- * Note: When returning to a byte read, remaining bits are dropped
1722
+ * Note: When returning to a byte write, remaining bits are dropped
1899
1723
  *
1900
1724
  * @param {number} value - value as int
1901
1725
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1907,7 +1731,7 @@ export class biwriter {
1907
1731
  /**
1908
1732
  * Bit field writer
1909
1733
  *
1910
- * Note: When returning to a byte read, remaining bits are dropped
1734
+ * Note: When returning to a byte write, remaining bits are dropped
1911
1735
  *
1912
1736
  * @param {number} value - value as int
1913
1737
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1920,7 +1744,7 @@ export class biwriter {
1920
1744
  /**
1921
1745
  * Bit field writer
1922
1746
  *
1923
- * Note: When returning to a byte read, remaining bits are dropped
1747
+ * Note: When returning to a byte write, remaining bits are dropped
1924
1748
  *
1925
1749
  * @param {number} value - value as int
1926
1750
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1932,7 +1756,7 @@ export class biwriter {
1932
1756
  /**
1933
1757
  * Bit field writer
1934
1758
  *
1935
- * Note: When returning to a byte read, remaining bits are dropped
1759
+ * Note: When returning to a byte write, remaining bits are dropped
1936
1760
  *
1937
1761
  * @param {number} value - value as int
1938
1762
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1945,7 +1769,7 @@ export class biwriter {
1945
1769
  /**
1946
1770
  * Bit field writer
1947
1771
  *
1948
- * Note: When returning to a byte read, remaining bits are dropped
1772
+ * Note: When returning to a byte write, remaining bits are dropped
1949
1773
  *
1950
1774
  * @param {number} value - value as int
1951
1775
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1957,7 +1781,7 @@ export class biwriter {
1957
1781
  /**
1958
1782
  * Bit field writer
1959
1783
  *
1960
- * Note: When returning to a byte read, remaining bits are dropped
1784
+ * Note: When returning to a byte write, remaining bits are dropped
1961
1785
  *
1962
1786
  * @param {number} value - value as int
1963
1787
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1970,7 +1794,7 @@ export class biwriter {
1970
1794
  /**
1971
1795
  * Bit field writer
1972
1796
  *
1973
- * Note: When returning to a byte read, remaining bits are dropped
1797
+ * Note: When returning to a byte write, remaining bits are dropped
1974
1798
  *
1975
1799
  * @param {number} value - value as int
1976
1800
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1982,7 +1806,7 @@ export class biwriter {
1982
1806
  /**
1983
1807
  * Bit field writer
1984
1808
  *
1985
- * Note: When returning to a byte read, remaining bits are dropped
1809
+ * Note: When returning to a byte write, remaining bits are dropped
1986
1810
  *
1987
1811
  * @param {number} value - value as int
1988
1812
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -1995,7 +1819,7 @@ export class biwriter {
1995
1819
  /**
1996
1820
  * Bit field writer
1997
1821
  *
1998
- * Note: When returning to a byte read, remaining bits are dropped
1822
+ * Note: When returning to a byte write, remaining bits are dropped
1999
1823
  *
2000
1824
  * @param {number} value - value as int
2001
1825
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2007,7 +1831,7 @@ export class biwriter {
2007
1831
  /**
2008
1832
  * Bit field writer
2009
1833
  *
2010
- * Note: When returning to a byte read, remaining bits are dropped
1834
+ * Note: When returning to a byte write, remaining bits are dropped
2011
1835
  *
2012
1836
  * @param {number} value - value as int
2013
1837
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2020,7 +1844,7 @@ export class biwriter {
2020
1844
  /**
2021
1845
  * Bit field writer
2022
1846
  *
2023
- * Note: When returning to a byte read, remaining bits are dropped
1847
+ * Note: When returning to a byte write, remaining bits are dropped
2024
1848
  *
2025
1849
  * @param {number} value - value as int
2026
1850
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2032,7 +1856,7 @@ export class biwriter {
2032
1856
  /**
2033
1857
  * Bit field writer
2034
1858
  *
2035
- * Note: When returning to a byte read, remaining bits are dropped
1859
+ * Note: When returning to a byte write, remaining bits are dropped
2036
1860
  *
2037
1861
  * @param {number} value - value as int
2038
1862
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2045,7 +1869,7 @@ export class biwriter {
2045
1869
  /**
2046
1870
  * Bit field writer
2047
1871
  *
2048
- * Note: When returning to a byte read, remaining bits are dropped
1872
+ * Note: When returning to a byte write, remaining bits are dropped
2049
1873
  *
2050
1874
  * @param {number} value - value as int
2051
1875
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2057,7 +1881,7 @@ export class biwriter {
2057
1881
  /**
2058
1882
  * Bit field writer
2059
1883
  *
2060
- * Note: When returning to a byte read, remaining bits are dropped
1884
+ * Note: When returning to a byte write, remaining bits are dropped
2061
1885
  *
2062
1886
  * @param {number} value - value as int
2063
1887
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2070,7 +1894,7 @@ export class biwriter {
2070
1894
  /**
2071
1895
  * Bit field writer
2072
1896
  *
2073
- * Note: When returning to a byte read, remaining bits are dropped
1897
+ * Note: When returning to a byte write, remaining bits are dropped
2074
1898
  *
2075
1899
  * @param {number} value - value as int
2076
1900
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2082,7 +1906,7 @@ export class biwriter {
2082
1906
  /**
2083
1907
  * Bit field writer
2084
1908
  *
2085
- * Note: When returning to a byte read, remaining bits are dropped
1909
+ * Note: When returning to a byte write, remaining bits are dropped
2086
1910
  *
2087
1911
  * @param {number} value - value as int
2088
1912
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2095,7 +1919,7 @@ export class biwriter {
2095
1919
  /**
2096
1920
  * Bit field writer
2097
1921
  *
2098
- * Note: When returning to a byte read, remaining bits are dropped
1922
+ * Note: When returning to a byte write, remaining bits are dropped
2099
1923
  *
2100
1924
  * @param {number} value - value as int
2101
1925
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2107,7 +1931,7 @@ export class biwriter {
2107
1931
  /**
2108
1932
  * Bit field writer
2109
1933
  *
2110
- * Note: When returning to a byte read, remaining bits are dropped
1934
+ * Note: When returning to a byte write, remaining bits are dropped
2111
1935
  *
2112
1936
  * @param {number} value - value as int
2113
1937
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2120,7 +1944,7 @@ export class biwriter {
2120
1944
  /**
2121
1945
  * Bit field writer
2122
1946
  *
2123
- * Note: When returning to a byte read, remaining bits are dropped
1947
+ * Note: When returning to a byte write, remaining bits are dropped
2124
1948
  *
2125
1949
  * @param {number} value - value as int
2126
1950
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2132,7 +1956,7 @@ export class biwriter {
2132
1956
  /**
2133
1957
  * Bit field writer
2134
1958
  *
2135
- * Note: When returning to a byte read, remaining bits are dropped
1959
+ * Note: When returning to a byte write, remaining bits are dropped
2136
1960
  *
2137
1961
  * @param {number} value - value as int
2138
1962
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2145,7 +1969,7 @@ export class biwriter {
2145
1969
  /**
2146
1970
  * Bit field writer
2147
1971
  *
2148
- * Note: When returning to a byte read, remaining bits are dropped
1972
+ * Note: When returning to a byte write, remaining bits are dropped
2149
1973
  *
2150
1974
  * @param {number} value - value as int
2151
1975
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2157,7 +1981,7 @@ export class biwriter {
2157
1981
  /**
2158
1982
  * Bit field writer
2159
1983
  *
2160
- * Note: When returning to a byte read, remaining bits are dropped
1984
+ * Note: When returning to a byte write, remaining bits are dropped
2161
1985
  *
2162
1986
  * @param {number} value - value as int
2163
1987
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2170,7 +1994,7 @@ export class biwriter {
2170
1994
  /**
2171
1995
  * Bit field writer
2172
1996
  *
2173
- * Note: When returning to a byte read, remaining bits are dropped
1997
+ * Note: When returning to a byte write, remaining bits are dropped
2174
1998
  *
2175
1999
  * @param {number} value - value as int
2176
2000
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2182,7 +2006,7 @@ export class biwriter {
2182
2006
  /**
2183
2007
  * Bit field writer
2184
2008
  *
2185
- * Note: When returning to a byte read, remaining bits are dropped
2009
+ * Note: When returning to a byte write, remaining bits are dropped
2186
2010
  *
2187
2011
  * @param {number} value - value as int
2188
2012
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2195,7 +2019,7 @@ export class biwriter {
2195
2019
  /**
2196
2020
  * Bit field writer
2197
2021
  *
2198
- * Note: When returning to a byte read, remaining bits are dropped
2022
+ * Note: When returning to a byte write, remaining bits are dropped
2199
2023
  *
2200
2024
  * @param {number} value - value as int
2201
2025
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2207,7 +2031,7 @@ export class biwriter {
2207
2031
  /**
2208
2032
  * Bit field writer
2209
2033
  *
2210
- * Note: When returning to a byte read, remaining bits are dropped
2034
+ * Note: When returning to a byte write, remaining bits are dropped
2211
2035
  *
2212
2036
  * @param {number} value - value as int
2213
2037
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2220,7 +2044,7 @@ export class biwriter {
2220
2044
  /**
2221
2045
  * Bit field writer
2222
2046
  *
2223
- * Note: When returning to a byte read, remaining bits are dropped
2047
+ * Note: When returning to a byte write, remaining bits are dropped
2224
2048
  *
2225
2049
  * @param {number} value - value as int
2226
2050
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2232,7 +2056,7 @@ export class biwriter {
2232
2056
  /**
2233
2057
  * Bit field writer
2234
2058
  *
2235
- * Note: When returning to a byte read, remaining bits are dropped
2059
+ * Note: When returning to a byte write, remaining bits are dropped
2236
2060
  *
2237
2061
  * @param {number} value - value as int
2238
2062
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2245,7 +2069,7 @@ export class biwriter {
2245
2069
  /**
2246
2070
  * Bit field writer
2247
2071
  *
2248
- * Note: When returning to a byte read, remaining bits are dropped
2072
+ * Note: When returning to a byte write, remaining bits are dropped
2249
2073
  *
2250
2074
  * @param {number} value - value as int
2251
2075
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2257,7 +2081,7 @@ export class biwriter {
2257
2081
  /**
2258
2082
  * Bit field writer
2259
2083
  *
2260
- * Note: When returning to a byte read, remaining bits are dropped
2084
+ * Note: When returning to a byte write, remaining bits are dropped
2261
2085
  *
2262
2086
  * @param {number} value - value as int
2263
2087
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2270,7 +2094,7 @@ export class biwriter {
2270
2094
  /**
2271
2095
  * Bit field writer
2272
2096
  *
2273
- * Note: When returning to a byte read, remaining bits are dropped
2097
+ * Note: When returning to a byte write, remaining bits are dropped
2274
2098
  *
2275
2099
  * @param {number} value - value as int
2276
2100
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2282,7 +2106,7 @@ export class biwriter {
2282
2106
  /**
2283
2107
  * Bit field writer
2284
2108
  *
2285
- * Note: When returning to a byte read, remaining bits are dropped
2109
+ * Note: When returning to a byte write, remaining bits are dropped
2286
2110
  *
2287
2111
  * @param {number} value - value as int
2288
2112
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2295,7 +2119,7 @@ export class biwriter {
2295
2119
  /**
2296
2120
  * Bit field writer
2297
2121
  *
2298
- * Note: When returning to a byte read, remaining bits are dropped
2122
+ * Note: When returning to a byte write, remaining bits are dropped
2299
2123
  *
2300
2124
  * @param {number} value - value as int
2301
2125
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2307,7 +2131,7 @@ export class biwriter {
2307
2131
  /**
2308
2132
  * Bit field writer
2309
2133
  *
2310
- * Note: When returning to a byte read, remaining bits are dropped
2134
+ * Note: When returning to a byte write, remaining bits are dropped
2311
2135
  *
2312
2136
  * @param {number} value - value as int
2313
2137
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2320,7 +2144,7 @@ export class biwriter {
2320
2144
  /**
2321
2145
  * Bit field writer
2322
2146
  *
2323
- * Note: When returning to a byte read, remaining bits are dropped
2147
+ * Note: When returning to a byte write, remaining bits are dropped
2324
2148
  *
2325
2149
  * @param {number} value - value as int
2326
2150
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2332,7 +2156,7 @@ export class biwriter {
2332
2156
  /**
2333
2157
  * Bit field writer
2334
2158
  *
2335
- * Note: When returning to a byte read, remaining bits are dropped
2159
+ * Note: When returning to a byte write, remaining bits are dropped
2336
2160
  *
2337
2161
  * @param {number} value - value as int
2338
2162
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2345,7 +2169,7 @@ export class biwriter {
2345
2169
  /**
2346
2170
  * Bit field writer
2347
2171
  *
2348
- * Note: When returning to a byte read, remaining bits are dropped
2172
+ * Note: When returning to a byte write, remaining bits are dropped
2349
2173
  *
2350
2174
  * @param {number} value - value as int
2351
2175
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2357,7 +2181,7 @@ export class biwriter {
2357
2181
  /**
2358
2182
  * Bit field writer
2359
2183
  *
2360
- * Note: When returning to a byte read, remaining bits are dropped
2184
+ * Note: When returning to a byte write, remaining bits are dropped
2361
2185
  *
2362
2186
  * @param {number} value - value as int
2363
2187
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2370,7 +2194,7 @@ export class biwriter {
2370
2194
  /**
2371
2195
  * Bit field writer
2372
2196
  *
2373
- * Note: When returning to a byte read, remaining bits are dropped
2197
+ * Note: When returning to a byte write, remaining bits are dropped
2374
2198
  *
2375
2199
  * @param {number} value - value as int
2376
2200
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2382,7 +2206,7 @@ export class biwriter {
2382
2206
  /**
2383
2207
  * Bit field writer
2384
2208
  *
2385
- * Note: When returning to a byte read, remaining bits are dropped
2209
+ * Note: When returning to a byte write, remaining bits are dropped
2386
2210
  *
2387
2211
  * @param {number} value - value as int
2388
2212
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2395,7 +2219,7 @@ export class biwriter {
2395
2219
  /**
2396
2220
  * Bit field writer
2397
2221
  *
2398
- * Note: When returning to a byte read, remaining bits are dropped
2222
+ * Note: When returning to a byte write, remaining bits are dropped
2399
2223
  *
2400
2224
  * @param {number} value - value as int
2401
2225
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2407,7 +2231,7 @@ export class biwriter {
2407
2231
  /**
2408
2232
  * Bit field writer
2409
2233
  *
2410
- * Note: When returning to a byte read, remaining bits are dropped
2234
+ * Note: When returning to a byte write, remaining bits are dropped
2411
2235
  *
2412
2236
  * @param {number} value - value as int
2413
2237
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2420,7 +2244,7 @@ export class biwriter {
2420
2244
  /**
2421
2245
  * Bit field writer
2422
2246
  *
2423
- * Note: When returning to a byte read, remaining bits are dropped
2247
+ * Note: When returning to a byte write, remaining bits are dropped
2424
2248
  *
2425
2249
  * @param {number} value - value as int
2426
2250
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2432,7 +2256,7 @@ export class biwriter {
2432
2256
  /**
2433
2257
  * Bit field writer
2434
2258
  *
2435
- * Note: When returning to a byte read, remaining bits are dropped
2259
+ * Note: When returning to a byte write, remaining bits are dropped
2436
2260
  *
2437
2261
  * @param {number} value - value as int
2438
2262
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2445,7 +2269,7 @@ export class biwriter {
2445
2269
  /**
2446
2270
  * Bit field writer
2447
2271
  *
2448
- * Note: When returning to a byte read, remaining bits are dropped
2272
+ * Note: When returning to a byte write, remaining bits are dropped
2449
2273
  *
2450
2274
  * @param {number} value - value as int
2451
2275
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2457,7 +2281,7 @@ export class biwriter {
2457
2281
  /**
2458
2282
  * Bit field writer
2459
2283
  *
2460
- * Note: When returning to a byte read, remaining bits are dropped
2284
+ * Note: When returning to a byte write, remaining bits are dropped
2461
2285
  *
2462
2286
  * @param {number} value - value as int
2463
2287
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2470,7 +2294,7 @@ export class biwriter {
2470
2294
  /**
2471
2295
  * Bit field writer
2472
2296
  *
2473
- * Note: When returning to a byte read, remaining bits are dropped
2297
+ * Note: When returning to a byte write, remaining bits are dropped
2474
2298
  *
2475
2299
  * @param {number} value - value as int
2476
2300
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2482,7 +2306,7 @@ export class biwriter {
2482
2306
  /**
2483
2307
  * Bit field writer
2484
2308
  *
2485
- * Note: When returning to a byte read, remaining bits are dropped
2309
+ * Note: When returning to a byte write, remaining bits are dropped
2486
2310
  *
2487
2311
  * @param {number} value - value as int
2488
2312
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2495,7 +2319,7 @@ export class biwriter {
2495
2319
  /**
2496
2320
  * Bit field writer
2497
2321
  *
2498
- * Note: When returning to a byte read, remaining bits are dropped
2322
+ * Note: When returning to a byte write, remaining bits are dropped
2499
2323
  *
2500
2324
  * @param {number} value - value as int
2501
2325
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2507,7 +2331,7 @@ export class biwriter {
2507
2331
  /**
2508
2332
  * Bit field writer
2509
2333
  *
2510
- * Note: When returning to a byte read, remaining bits are dropped
2334
+ * Note: When returning to a byte write, remaining bits are dropped
2511
2335
  *
2512
2336
  * @param {number} value - value as int
2513
2337
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2520,7 +2344,7 @@ export class biwriter {
2520
2344
  /**
2521
2345
  * Bit field writer
2522
2346
  *
2523
- * Note: When returning to a byte read, remaining bits are dropped
2347
+ * Note: When returning to a byte write, remaining bits are dropped
2524
2348
  *
2525
2349
  * @param {number} value - value as int
2526
2350
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2532,7 +2356,7 @@ export class biwriter {
2532
2356
  /**
2533
2357
  * Bit field writer
2534
2358
  *
2535
- * Note: When returning to a byte read, remaining bits are dropped
2359
+ * Note: When returning to a byte write, remaining bits are dropped
2536
2360
  *
2537
2361
  * @param {number} value - value as int
2538
2362
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2545,7 +2369,7 @@ export class biwriter {
2545
2369
  /**
2546
2370
  * Bit field writer
2547
2371
  *
2548
- * Note: When returning to a byte read, remaining bits are dropped
2372
+ * Note: When returning to a byte write, remaining bits are dropped
2549
2373
  *
2550
2374
  * @param {number} value - value as int
2551
2375
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2557,7 +2381,7 @@ export class biwriter {
2557
2381
  /**
2558
2382
  * Bit field writer
2559
2383
  *
2560
- * Note: When returning to a byte read, remaining bits are dropped
2384
+ * Note: When returning to a byte write, remaining bits are dropped
2561
2385
  *
2562
2386
  * @param {number} value - value as int
2563
2387
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2570,7 +2394,7 @@ export class biwriter {
2570
2394
  /**
2571
2395
  * Bit field writer
2572
2396
  *
2573
- * Note: When returning to a byte read, remaining bits are dropped
2397
+ * Note: When returning to a byte write, remaining bits are dropped
2574
2398
  *
2575
2399
  * @param {number} value - value as int
2576
2400
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2582,7 +2406,7 @@ export class biwriter {
2582
2406
  /**
2583
2407
  * Bit field writer
2584
2408
  *
2585
- * Note: When returning to a byte read, remaining bits are dropped
2409
+ * Note: When returning to a byte write, remaining bits are dropped
2586
2410
  *
2587
2411
  * @param {number} value - value as int
2588
2412
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2595,7 +2419,7 @@ export class biwriter {
2595
2419
  /**
2596
2420
  * Bit field writer
2597
2421
  *
2598
- * Note: When returning to a byte read, remaining bits are dropped
2422
+ * Note: When returning to a byte write, remaining bits are dropped
2599
2423
  *
2600
2424
  * @param {number} value - value as int
2601
2425
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2607,7 +2431,7 @@ export class biwriter {
2607
2431
  /**
2608
2432
  * Bit field writer
2609
2433
  *
2610
- * Note: When returning to a byte read, remaining bits are dropped
2434
+ * Note: When returning to a byte write, remaining bits are dropped
2611
2435
  *
2612
2436
  * @param {number} value - value as int
2613
2437
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2620,7 +2444,7 @@ export class biwriter {
2620
2444
  /**
2621
2445
  * Bit field writer
2622
2446
  *
2623
- * Note: When returning to a byte read, remaining bits are dropped
2447
+ * Note: When returning to a byte write, remaining bits are dropped
2624
2448
  *
2625
2449
  * @param {number} value - value as int
2626
2450
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2632,7 +2456,7 @@ export class biwriter {
2632
2456
  /**
2633
2457
  * Bit field writer
2634
2458
  *
2635
- * Note: When returning to a byte read, remaining bits are dropped
2459
+ * Note: When returning to a byte write, remaining bits are dropped
2636
2460
  *
2637
2461
  * @param {number} value - value as int
2638
2462
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2645,7 +2469,7 @@ export class biwriter {
2645
2469
  /**
2646
2470
  * Bit field writer
2647
2471
  *
2648
- * Note: When returning to a byte read, remaining bits are dropped
2472
+ * Note: When returning to a byte write, remaining bits are dropped
2649
2473
  *
2650
2474
  * @param {number} value - value as int
2651
2475
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2657,7 +2481,7 @@ export class biwriter {
2657
2481
  /**
2658
2482
  * Bit field writer
2659
2483
  *
2660
- * Note: When returning to a byte read, remaining bits are dropped
2484
+ * Note: When returning to a byte write, remaining bits are dropped
2661
2485
  *
2662
2486
  * @param {number} value - value as int
2663
2487
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2670,7 +2494,7 @@ export class biwriter {
2670
2494
  /**
2671
2495
  * Bit field writer
2672
2496
  *
2673
- * Note: When returning to a byte read, remaining bits are dropped
2497
+ * Note: When returning to a byte write, remaining bits are dropped
2674
2498
  *
2675
2499
  * @param {number} value - value as int
2676
2500
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2682,7 +2506,7 @@ export class biwriter {
2682
2506
  /**
2683
2507
  * Bit field writer
2684
2508
  *
2685
- * Note: When returning to a byte read, remaining bits are dropped
2509
+ * Note: When returning to a byte write, remaining bits are dropped
2686
2510
  *
2687
2511
  * @param {number} value - value as int
2688
2512
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2695,7 +2519,7 @@ export class biwriter {
2695
2519
  /**
2696
2520
  * Bit field writer
2697
2521
  *
2698
- * Note: When returning to a byte read, remaining bits are dropped
2522
+ * Note: When returning to a byte write, remaining bits are dropped
2699
2523
  *
2700
2524
  * @param {number} value - value as int
2701
2525
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2707,7 +2531,7 @@ export class biwriter {
2707
2531
  /**
2708
2532
  * Bit field writer
2709
2533
  *
2710
- * Note: When returning to a byte read, remaining bits are dropped
2534
+ * Note: When returning to a byte write, remaining bits are dropped
2711
2535
  *
2712
2536
  * @param {number} value - value as int
2713
2537
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2720,7 +2544,7 @@ export class biwriter {
2720
2544
  /**
2721
2545
  * Bit field writer
2722
2546
  *
2723
- * Note: When returning to a byte read, remaining bits are dropped
2547
+ * Note: When returning to a byte write, remaining bits are dropped
2724
2548
  *
2725
2549
  * @param {number} value - value as int
2726
2550
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2732,7 +2556,7 @@ export class biwriter {
2732
2556
  /**
2733
2557
  * Bit field writer
2734
2558
  *
2735
- * Note: When returning to a byte read, remaining bits are dropped
2559
+ * Note: When returning to a byte write, remaining bits are dropped
2736
2560
  *
2737
2561
  * @param {number} value - value as int
2738
2562
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2745,7 +2569,7 @@ export class biwriter {
2745
2569
  /**
2746
2570
  * Bit field writer
2747
2571
  *
2748
- * Note: When returning to a byte read, remaining bits are dropped
2572
+ * Note: When returning to a byte write, remaining bits are dropped
2749
2573
  *
2750
2574
  * @param {number} value - value as int
2751
2575
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2757,7 +2581,7 @@ export class biwriter {
2757
2581
  /**
2758
2582
  * Bit field writer
2759
2583
  *
2760
- * Note: When returning to a byte read, remaining bits are dropped
2584
+ * Note: When returning to a byte write, remaining bits are dropped
2761
2585
  *
2762
2586
  * @param {number} value - value as int
2763
2587
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2770,7 +2594,7 @@ export class biwriter {
2770
2594
  /**
2771
2595
  * Bit field writer
2772
2596
  *
2773
- * Note: When returning to a byte read, remaining bits are dropped
2597
+ * Note: When returning to a byte write, remaining bits are dropped
2774
2598
  *
2775
2599
  * @param {number} value - value as int
2776
2600
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2782,7 +2606,7 @@ export class biwriter {
2782
2606
  /**
2783
2607
  * Bit field writer
2784
2608
  *
2785
- * Note: When returning to a byte read, remaining bits are dropped
2609
+ * Note: When returning to a byte write, remaining bits are dropped
2786
2610
  *
2787
2611
  * @param {number} value - value as int
2788
2612
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2795,7 +2619,7 @@ export class biwriter {
2795
2619
  /**
2796
2620
  * Bit field writer
2797
2621
  *
2798
- * Note: When returning to a byte read, remaining bits are dropped
2622
+ * Note: When returning to a byte write, remaining bits are dropped
2799
2623
  *
2800
2624
  * @param {number} value - value as int
2801
2625
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2807,7 +2631,7 @@ export class biwriter {
2807
2631
  /**
2808
2632
  * Bit field writer
2809
2633
  *
2810
- * Note: When returning to a byte read, remaining bits are dropped
2634
+ * Note: When returning to a byte write, remaining bits are dropped
2811
2635
  *
2812
2636
  * @param {number} value - value as int
2813
2637
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2820,7 +2644,7 @@ export class biwriter {
2820
2644
  /**
2821
2645
  * Bit field writer
2822
2646
  *
2823
- * Note: When returning to a byte read, remaining bits are dropped
2647
+ * Note: When returning to a byte write, remaining bits are dropped
2824
2648
  *
2825
2649
  * @param {number} value - value as int
2826
2650
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2832,7 +2656,7 @@ export class biwriter {
2832
2656
  /**
2833
2657
  * Bit field writer
2834
2658
  *
2835
- * Note: When returning to a byte read, remaining bits are dropped
2659
+ * Note: When returning to a byte write, remaining bits are dropped
2836
2660
  *
2837
2661
  * @param {number} value - value as int
2838
2662
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2845,7 +2669,7 @@ export class biwriter {
2845
2669
  /**
2846
2670
  * Bit field writer
2847
2671
  *
2848
- * Note: When returning to a byte read, remaining bits are dropped
2672
+ * Note: When returning to a byte write, remaining bits are dropped
2849
2673
  *
2850
2674
  * @param {number} value - value as int
2851
2675
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2857,7 +2681,7 @@ export class biwriter {
2857
2681
  /**
2858
2682
  * Bit field writer
2859
2683
  *
2860
- * Note: When returning to a byte read, remaining bits are dropped
2684
+ * Note: When returning to a byte write, remaining bits are dropped
2861
2685
  *
2862
2686
  * @param {number} value - value as int
2863
2687
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2870,7 +2694,7 @@ export class biwriter {
2870
2694
  /**
2871
2695
  * Bit field writer
2872
2696
  *
2873
- * Note: When returning to a byte read, remaining bits are dropped
2697
+ * Note: When returning to a byte write, remaining bits are dropped
2874
2698
  *
2875
2699
  * @param {number} value - value as int
2876
2700
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2882,7 +2706,7 @@ export class biwriter {
2882
2706
  /**
2883
2707
  * Bit field writer
2884
2708
  *
2885
- * Note: When returning to a byte read, remaining bits are dropped
2709
+ * Note: When returning to a byte write, remaining bits are dropped
2886
2710
  *
2887
2711
  * @param {number} value - value as int
2888
2712
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2895,7 +2719,7 @@ export class biwriter {
2895
2719
  /**
2896
2720
  * Bit field writer
2897
2721
  *
2898
- * Note: When returning to a byte read, remaining bits are dropped
2722
+ * Note: When returning to a byte write, remaining bits are dropped
2899
2723
  *
2900
2724
  * @param {number} value - value as int
2901
2725
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2907,7 +2731,7 @@ export class biwriter {
2907
2731
  /**
2908
2732
  * Bit field writer
2909
2733
  *
2910
- * Note: When returning to a byte read, remaining bits are dropped
2734
+ * Note: When returning to a byte write, remaining bits are dropped
2911
2735
  *
2912
2736
  * @param {number} value - value as int
2913
2737
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2920,7 +2744,7 @@ export class biwriter {
2920
2744
  /**
2921
2745
  * Bit field writer
2922
2746
  *
2923
- * Note: When returning to a byte read, remaining bits are dropped
2747
+ * Note: When returning to a byte write, remaining bits are dropped
2924
2748
  *
2925
2749
  * @param {number} value - value as int
2926
2750
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2932,7 +2756,7 @@ export class biwriter {
2932
2756
  /**
2933
2757
  * Bit field writer
2934
2758
  *
2935
- * Note: When returning to a byte read, remaining bits are dropped
2759
+ * Note: When returning to a byte write, remaining bits are dropped
2936
2760
  *
2937
2761
  * @param {number} value - value as int
2938
2762
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2945,7 +2769,7 @@ export class biwriter {
2945
2769
  /**
2946
2770
  * Bit field writer
2947
2771
  *
2948
- * Note: When returning to a byte read, remaining bits are dropped
2772
+ * Note: When returning to a byte write, remaining bits are dropped
2949
2773
  *
2950
2774
  * @param {number} value - value as int
2951
2775
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2957,7 +2781,7 @@ export class biwriter {
2957
2781
  /**
2958
2782
  * Bit field writer
2959
2783
  *
2960
- * Note: When returning to a byte read, remaining bits are dropped
2784
+ * Note: When returning to a byte write, remaining bits are dropped
2961
2785
  *
2962
2786
  * @param {number} value - value as int
2963
2787
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2970,7 +2794,7 @@ export class biwriter {
2970
2794
  /**
2971
2795
  * Bit field writer
2972
2796
  *
2973
- * Note: When returning to a byte read, remaining bits are dropped
2797
+ * Note: When returning to a byte write, remaining bits are dropped
2974
2798
  *
2975
2799
  * @param {number} value - value as int
2976
2800
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2982,7 +2806,7 @@ export class biwriter {
2982
2806
  /**
2983
2807
  * Bit field writer
2984
2808
  *
2985
- * Note: When returning to a byte read, remaining bits are dropped
2809
+ * Note: When returning to a byte write, remaining bits are dropped
2986
2810
  *
2987
2811
  * @param {number} value - value as int
2988
2812
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -2995,7 +2819,7 @@ export class biwriter {
2995
2819
  /**
2996
2820
  * Bit field writer
2997
2821
  *
2998
- * Note: When returning to a byte read, remaining bits are dropped
2822
+ * Note: When returning to a byte write, remaining bits are dropped
2999
2823
  *
3000
2824
  * @param {number} value - value as int
3001
2825
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3007,7 +2831,7 @@ export class biwriter {
3007
2831
  /**
3008
2832
  * Bit field writer
3009
2833
  *
3010
- * Note: When returning to a byte read, remaining bits are dropped
2834
+ * Note: When returning to a byte write, remaining bits are dropped
3011
2835
  *
3012
2836
  * @param {number} value - value as int
3013
2837
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3020,7 +2844,7 @@ export class biwriter {
3020
2844
  /**
3021
2845
  * Bit field writer
3022
2846
  *
3023
- * Note: When returning to a byte read, remaining bits are dropped
2847
+ * Note: When returning to a byte write, remaining bits are dropped
3024
2848
  *
3025
2849
  * @param {number} value - value as int
3026
2850
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3032,7 +2856,7 @@ export class biwriter {
3032
2856
  /**
3033
2857
  * Bit field writer
3034
2858
  *
3035
- * Note: When returning to a byte read, remaining bits are dropped
2859
+ * Note: When returning to a byte write, remaining bits are dropped
3036
2860
  *
3037
2861
  * @param {number} value - value as int
3038
2862
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3045,7 +2869,7 @@ export class biwriter {
3045
2869
  /**
3046
2870
  * Bit field writer
3047
2871
  *
3048
- * Note: When returning to a byte read, remaining bits are dropped
2872
+ * Note: When returning to a byte write, remaining bits are dropped
3049
2873
  *
3050
2874
  * @param {number} value - value as int
3051
2875
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3057,7 +2881,7 @@ export class biwriter {
3057
2881
  /**
3058
2882
  * Bit field writer
3059
2883
  *
3060
- * Note: When returning to a byte read, remaining bits are dropped
2884
+ * Note: When returning to a byte write, remaining bits are dropped
3061
2885
  *
3062
2886
  * @param {number} value - value as int
3063
2887
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3070,7 +2894,7 @@ export class biwriter {
3070
2894
  /**
3071
2895
  * Bit field writer
3072
2896
  *
3073
- * Note: When returning to a byte read, remaining bits are dropped
2897
+ * Note: When returning to a byte write, remaining bits are dropped
3074
2898
  *
3075
2899
  * @param {number} value - value as int
3076
2900
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3082,7 +2906,7 @@ export class biwriter {
3082
2906
  /**
3083
2907
  * Bit field writer
3084
2908
  *
3085
- * Note: When returning to a byte read, remaining bits are dropped
2909
+ * Note: When returning to a byte write, remaining bits are dropped
3086
2910
  *
3087
2911
  * @param {number} value - value as int
3088
2912
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3095,7 +2919,7 @@ export class biwriter {
3095
2919
  /**
3096
2920
  * Bit field writer
3097
2921
  *
3098
- * Note: When returning to a byte read, remaining bits are dropped
2922
+ * Note: When returning to a byte write, remaining bits are dropped
3099
2923
  *
3100
2924
  * @param {number} value - value as int
3101
2925
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3107,7 +2931,7 @@ export class biwriter {
3107
2931
  /**
3108
2932
  * Bit field writer
3109
2933
  *
3110
- * Note: When returning to a byte read, remaining bits are dropped
2934
+ * Note: When returning to a byte write, remaining bits are dropped
3111
2935
  *
3112
2936
  * @param {number} value - value as int
3113
2937
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3120,7 +2944,7 @@ export class biwriter {
3120
2944
  /**
3121
2945
  * Bit field writer
3122
2946
  *
3123
- * Note: When returning to a byte read, remaining bits are dropped
2947
+ * Note: When returning to a byte write, remaining bits are dropped
3124
2948
  *
3125
2949
  * @param {number} value - value as int
3126
2950
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3132,7 +2956,7 @@ export class biwriter {
3132
2956
  /**
3133
2957
  * Bit field writer
3134
2958
  *
3135
- * Note: When returning to a byte read, remaining bits are dropped
2959
+ * Note: When returning to a byte write, remaining bits are dropped
3136
2960
  *
3137
2961
  * @param {number} value - value as int
3138
2962
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3145,7 +2969,7 @@ export class biwriter {
3145
2969
  /**
3146
2970
  * Bit field writer
3147
2971
  *
3148
- * Note: When returning to a byte read, remaining bits are dropped
2972
+ * Note: When returning to a byte write, remaining bits are dropped
3149
2973
  *
3150
2974
  * @param {number} value - value as int
3151
2975
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3157,7 +2981,7 @@ export class biwriter {
3157
2981
  /**
3158
2982
  * Bit field writer
3159
2983
  *
3160
- * Note: When returning to a byte read, remaining bits are dropped
2984
+ * Note: When returning to a byte write, remaining bits are dropped
3161
2985
  *
3162
2986
  * @param {number} value - value as int
3163
2987
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3170,7 +2994,7 @@ export class biwriter {
3170
2994
  /**
3171
2995
  * Bit field writer
3172
2996
  *
3173
- * Note: When returning to a byte read, remaining bits are dropped
2997
+ * Note: When returning to a byte write, remaining bits are dropped
3174
2998
  *
3175
2999
  * @param {number} value - value as int
3176
3000
  * @param {number} offsetBits - bit offset from current byte position to start the write (defaults last bit position)
@@ -3182,7 +3006,7 @@ export class biwriter {
3182
3006
  /**
3183
3007
  * Bit field writer
3184
3008
  *
3185
- * Note: When returning to a byte read, remaining bits are dropped
3009
+ * Note: When returning to a byte write, remaining bits are dropped
3186
3010
  *
3187
3011
  * @param {number} value - value as int
3188
3012
  * @param {number} bits - number of bits to write
@@ -3196,7 +3020,7 @@ export class biwriter {
3196
3020
  /**
3197
3021
  * Bit field writer
3198
3022
  *
3199
- * Note: When returning to a byte read, remaining bits are dropped
3023
+ * Note: When returning to a byte write, remaining bits are dropped
3200
3024
  *
3201
3025
  * @param {number} value - value as int
3202
3026
  * @param {number} bits - number of bits to write
@@ -3210,7 +3034,7 @@ export class biwriter {
3210
3034
  /**
3211
3035
  * Bit field writer
3212
3036
  *
3213
- * Note: When returning to a byte read, remaining bits are dropped
3037
+ * Note: When returning to a byte write, remaining bits are dropped
3214
3038
  *
3215
3039
  * @param {number} value - value as int
3216
3040
  * @param {number} bits - number of bits to write
@@ -3224,7 +3048,7 @@ export class biwriter {
3224
3048
  /**
3225
3049
  * Bit field writer
3226
3050
  *
3227
- * Note: When returning to a byte read, remaining bits are dropped
3051
+ * Note: When returning to a byte write, remaining bits are dropped
3228
3052
  *
3229
3053
  * @param {number} value - value as int
3230
3054
  * @param {number} bits - number of bits to write
@@ -4365,7 +4189,7 @@ export class biwriter {
4365
4189
  return this.writeInt64(value, offset, true, "big");
4366
4190
  }
4367
4191
  //
4368
- //doublefloat reader
4192
+ //doublefloat
4369
4193
  //
4370
4194
  /**
4371
4195
  * Writes double float
@@ -4571,7 +4395,7 @@ export class biwriter {
4571
4395
  }
4572
4396
  else {
4573
4397
  this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
4574
- throw new Error("Invalid length read size: " + lengthWriteSize);
4398
+ throw new Error("Invalid length write size: " + lengthWriteSize);
4575
4399
  }
4576
4400
  if (string.length > maxLength || (length || 0) > maxLength) {
4577
4401
  this.errorDump ? "[Error], hexdump:\n" + this.hexdump() : "";
@@ -4613,7 +4437,7 @@ export class biwriter {
4613
4437
  this.offset += totalLength;
4614
4438
  }
4615
4439
  else {
4616
- throw new Error('Unsupported string type.');
4440
+ throw new Error('Unsupported string type: ' + stringType);
4617
4441
  }
4618
4442
  }
4619
4443
  /**