Class ByteBuffer
🏭 Constructors
constructor
ByteBuffer(capacity: number, littleEndian: boolean, noAssert: boolean): ByteBufferConstructs a new ByteBuffer. The swiss army knife for binary data in JavaScript.
Parameters
- capacity:
numberInitial capacity. Defaults to ByteBuffer.DEFAULT_CAPACITY. - littleEndian:
booleanWhether to use little or big endian byte order. Defaults to ByteBuffer.DEFAULT_ENDIAN. - noAssert:
booleanWhether to skip assertions of offsets and values. Defaults to ByteBuffer.DEFAULT_NOASSERT.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:130
🏷️ Properties
buffer
buffer: ArrayBufferBacking ArrayBuffer.
Defined in: packages/bytebuffer/index.ts:75
limit
limit: numberAbsolute limit of the contained data. Set to the backing buffer's capacity upon allocation.
Defined in: packages/bytebuffer/index.ts:105
littleEndian
littleEndian: booleanWhether to use little endian byte order, defaults to false for big endian.
Defined in: packages/bytebuffer/index.ts:111
markedOffset
markedOffset: numberMarked offset.
Defined in: packages/bytebuffer/index.ts:97
noAssert
noAssert: booleanWhether to skip assertions of offsets and values, defaults to false.
Defined in: packages/bytebuffer/index.ts:117
offset
offset: numberAbsolute read/write offset.
Defined in: packages/bytebuffer/index.ts:89
readByte
readByte: (offset?: number) => number = ...Reads an 8bit signed integer. This is an alias of ByteBuffer#readInt8.
Defined in: packages/bytebuffer/index.ts:364
readDouble
readDouble: (offset?: number) => number = ...Reads a 64bit float. This is an alias of ByteBuffer#readFloat64.
Defined in: packages/bytebuffer/index.ts:822
readFloat
readFloat: (offset?: number) => number = ...Reads a 32bit float. This is an alias of ByteBuffer#readFloat32.
Defined in: packages/bytebuffer/index.ts:757
readInt
readInt: (offset?: number) => number = ...Reads a 32bit signed integer. This is an alias of ByteBuffer#readInt32.
Defined in: packages/bytebuffer/index.ts:632
readLong
readLong: (offset?: number) => bigint = ...Reads a 64bit signed integer. This is an alias of ByteBuffer#readInt64.
Defined in: packages/bytebuffer/index.ts:1390
readShort
readShort: (offset?: number) => number = ...Reads a 16bit signed integer. This is an alias of ByteBuffer#readInt16.
Defined in: packages/bytebuffer/index.ts:500
readUInt16
readUInt16: (offset?: number) => number = ...Reads a 16bit unsigned integer. This is an alias of ByteBuffer#readUint16.
Defined in: packages/bytebuffer/index.ts:570
readUInt32
readUInt32: (offset?: number) => number = ...Reads a 32bit unsigned integer. This is an alias of ByteBuffer#readUint32.
Defined in: packages/bytebuffer/index.ts:694
readUInt64
readUInt64: (offset?: number) => bigint = ...Reads a 64bit unsigned integer. This is an alias of ByteBuffer#readUint64.
Defined in: packages/bytebuffer/index.ts:1454
readUInt8
readUInt8: (offset?: number) => number = ...Reads an 8bit unsigned integer. This is an alias of ByteBuffer#readUint8.
Defined in: packages/bytebuffer/index.ts:428
toArrayBuffer
toArrayBuffer: (forceCopy?: boolean) => ArrayBuffer = ...Returns a raw buffer compacted to contain this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. This is an alias of ByteBuffer#toBuffer.
Defined in: packages/bytebuffer/index.ts:1498
view
view: DataViewDataView utilized to manipulate the backing buffer. Becomes null if the backing buffer has a capacity of 0.
Defined in: packages/bytebuffer/index.ts:81
writeByte
writeByte: (value: number, offset?: number) => ByteBuffer = ...Writes an 8bit signed integer. This is an alias of ByteBuffer#writeInt8.
Defined in: packages/bytebuffer/index.ts:336
writeBytes
writeBytes: (source: Uint8Array | ArrayBuffer | ByteBuffer, offset?: number) => ByteBuffer = ...Writes a payload of bytes. This is an alias of ByteBuffer#append.
Defined in: packages/bytebuffer/index.ts:298
writeDouble
writeDouble: (value: number, offset?: number) => ByteBuffer = ...Writes a 64bit float. This is an alias of ByteBuffer#writeFloat64.
Defined in: packages/bytebuffer/index.ts:794
writeFloat
writeFloat: (value: number, offset?: number) => ByteBuffer = ...Writes a 32bit float. This is an alias of ByteBuffer#writeFloat32.
Defined in: packages/bytebuffer/index.ts:729
writeInt
writeInt: (value: number, offset?: number) => ByteBuffer = ...Writes a 32bit signed integer. This is an alias of ByteBuffer#writeInt32.
Defined in: packages/bytebuffer/index.ts:605
writeLong
writeLong: (value: number | bigint, offset?: number) => ByteBuffer = ...Writes a 64bit signed integer. This is an alias of ByteBuffer#writeInt64.
Defined in: packages/bytebuffer/index.ts:1363
writeShort
writeShort: (value: number, offset?: number) => ByteBuffer = ...Writes a 16bit signed integer. This is an alias of ByteBuffer#writeInt16.
Defined in: packages/bytebuffer/index.ts:468
writeUInt16
writeUInt16: (value: number, offset?: number) => ByteBuffer = ...Writes a 16bit unsigned integer. This is an alias of ByteBuffer#writeUint16.
Defined in: packages/bytebuffer/index.ts:538
writeUInt32
writeUInt32: (value: number, offset?: number) => ByteBuffer = ...Writes a 32bit unsigned integer. This is an alias of ByteBuffer#writeUint32.
Defined in: packages/bytebuffer/index.ts:666
writeUInt64
writeUInt64: (value: number | bigint, offset?: number) => ByteBuffer = ...Writes a 64bit unsigned integer. This is an alias of ByteBuffer#writeUint64.
Defined in: packages/bytebuffer/index.ts:1426
writeUInt8
writeUInt8: (value: number, offset?: number) => ByteBuffer = ...Writes an 8bit unsigned integer. This is an alias of ByteBuffer#writeUint8.
Defined in: packages/bytebuffer/index.ts:400
accessor static
accessor: () => DataViewConstructor = ...Gets the accessor type.
Defined in: packages/bytebuffer/index.ts:155
allocate static
allocate: (capacity?: number, littleEndian?: boolean, noAssert?: boolean) => ByteBuffer = ...Allocates a new ByteBuffer backed by a buffer of the specified capacity.
Defined in: packages/bytebuffer/index.ts:169
BIG_ENDIAN static
BIG_ENDIAN: boolean = falseBig endian constant that can be used instead of its boolean value. Evaluates to false.
Defined in: packages/bytebuffer/index.ts:48
concat static
concat: (buffers: (Uint8Array | ArrayBuffer | ByteBuffer)[], littleEndian?: boolean, noAssert?: boolean) => ByteBuffer = ...Concatenates multiple ByteBuffers into one.
Defined in: packages/bytebuffer/index.ts:185
DEFAULT_CAPACITY static
DEFAULT_CAPACITY: number = 16Default initial capacity of 16.
Defined in: packages/bytebuffer/index.ts:55
DEFAULT_ENDIAN static
DEFAULT_ENDIAN: boolean = ByteBuffer.BIG_ENDIANDefault endianess of false for big endian.
Defined in: packages/bytebuffer/index.ts:62
DEFAULT_NOASSERT static
DEFAULT_NOASSERT: boolean = falseDefault no assertions flag of false.
Defined in: packages/bytebuffer/index.ts:69
LITTLE_ENDIAN static
LITTLE_ENDIAN: boolean = trueLittle endian constant that can be used instead of its boolean value. Evaluates to true.
Defined in: packages/bytebuffer/index.ts:40
type static
type: () => ArrayBufferConstructor = ...Gets the backing buffer type.
Defined in: packages/bytebuffer/index.ts:220
VERSION static
VERSION: string = '0.0.1'ByteBuffer version.
Defined in: packages/bytebuffer/index.ts:32
wrap static
wrap: (buffer: number[] | ArrayBuffer, littleEndian?: boolean, noAssert?: boolean) => ByteBuffer = ...Wraps a buffer or a string. Sets the allocated ByteBuffer's ByteBuffer#offset to 0 and its ByteBuffer#limit to the length of the wrapped data.
Defined in: packages/bytebuffer/index.ts:235
🔧 Methods
append
append(source: Uint8Array | ArrayBuffer | ByteBuffer, offset: number): ByteBufferAppends some data to this ByteBuffer. This will overwrite any contents behind the specified offset up to the appended data's length.
Parameters
- source:
Uint8Array | ArrayBuffer | ByteBufferData to append. Ifsourceis a ByteBuffer, its offsets will be modified according to the performed read operation. - offset:
numberOffset to append at. Will use and increase ByteBuffer#offset by the number of bytes written if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:837
appendTo
appendTo(target: ByteBuffer, offset: number): ByteBufferAppends this ByteBuffer's contents to another ByteBuffer. This will overwrite any contents at and after the specified offset up to the length of this ByteBuffer's data.
Parameters
- target:
ByteBufferTarget ByteBuffer - offset:
numberOffset to append to. Will use and increase ByteBuffer#offset by the number of bytes read if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:868
assert
assert(assert: boolean): ByteBufferEnables or disables assertions of argument types and offsets. Assertions are enabled by default but you can opt to disable them if your code already makes sure that everything is valid.
Parameters
- assert:
booleantrueto enable assertions, otherwisefalse
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:880
BE
BE(bigEndian: undefined | boolean): ByteBufferSwitches (to) big endian byte order.
Parameters
- bigEndian:
undefined | booleanDefaults totrue, otherwise uses little endian
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1146
capacity
capacity(): numberGets the capacity of this ByteBuffer's backing buffer.
Return Type
number
Defined in: packages/bytebuffer/index.ts:890
clear
clear(): ByteBufferClears this ByteBuffer's offsets by setting ByteBuffer#offset to 0 and ByteBuffer#limit to the backing buffer's capacity. Discards ByteBuffer#markedOffset.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:900
clone
clone(copy: boolean): ByteBufferCreates a cloned instance of this ByteBuffer, preset with this ByteBuffer's values for ByteBuffer#offset, ByteBuffer#markedOffset and ByteBuffer#limit.
Parameters
- copy:
booleanWhether to copy the backing buffer or to return another view on the same, defaults tofalse
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:914
compact
compact(begin: undefined | number, end: undefined | number): ByteBufferCompacts this ByteBuffer to be backed by a ByteBuffer#buffer of its contents' length. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit. Will set offset = 0 and limit = capacity and adapt ByteBuffer#markedOffset to the same relative position if set.
Parameters
- begin:
undefined | numberOffset to start at, defaults to ByteBuffer#offset - end:
undefined | numberOffset to end at, defaults to ByteBuffer#limit
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:939
copy
copy(begin: undefined | number, end: undefined | number): ByteBufferCreates a copy of this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit.
Parameters
- begin:
undefined | numberBegin offset, defaults to ByteBuffer#offset. - end:
undefined | numberEnd offset, defaults to ByteBuffer#limit.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:977
copyTo
copyTo(target: ByteBuffer, targetOffset: number, sourceOffset: number, sourceLimit: number): ByteBufferCopies this ByteBuffer's contents to another ByteBuffer. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit.
Parameters
- target:
ByteBufferTarget ByteBuffer - targetOffset:
numberOffset to copy to. Will use and increase the target's ByteBuffer#offset by the number of bytes copied if omitted. - sourceOffset:
numberOffset to start copying from. Will use and increase ByteBuffer#offset by the number of bytes copied if omitted. - sourceLimit:
numberOffset to end copying from, defaults to ByteBuffer#limit
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1009
ensureCapacity
ensureCapacity(capacity: number): ByteBufferMakes sure that this ByteBuffer is backed by a ByteBuffer#buffer of at least the specified capacity. If the current capacity is exceeded, it will be doubled. If double the current capacity is less than the required capacity, the required capacity will be used instead.
Parameters
- capacity:
numberRequired capacity
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1045
fill
fill(value: string | number, begin: number, end: number): ByteBufferOverwrites this ByteBuffer's contents with the specified value. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit.
Parameters
- value:
string | numberByte value to fill with. If given as a string, the first character is used. - begin:
numberBegin offset. Will use and increase ByteBuffer#offset by the number of bytes written if omitted. defaults to ByteBuffer#offset. - end:
numberEnd offset, defaults to ByteBuffer#limit.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1062
flip
flip(): ByteBufferMakes this ByteBuffer ready for a new sequence of write or relative read operations. Sets limit = offset and offset = 0. Make sure always to flip a ByteBuffer when all relative read or write operations are complete.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1089
LE
LE(littleEndian: undefined | boolean): ByteBufferSwitches (to) little endian byte order.
Parameters
- littleEndian:
undefined | booleanDefaults totrue, otherwise uses big endian
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1135
mark
mark(offset: number): ByteBufferMarks an offset on this ByteBuffer to be used later.
Parameters
- offset:
numberOffset to mark. Defaults to ByteBuffer#offset.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1104
order
order(littleEndian: boolean): ByteBufferSets the byte order.
Parameters
- littleEndian:
booleantruefor little endian byte order,falsefor big endian
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1121
prepend
prepend(source: ArrayBuffer | ByteBuffer, offset: number): ByteBufferPrepends some data to this ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly.
Parameters
- source:
ArrayBuffer | ByteBufferData to prepend. Ifsourceis a ByteBuffer, its offset will be modified according to the performed read operation. - offset:
numberOffset to prepend at. Will use and decrease ByteBuffer#offset by the number of bytes prepended if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1165
prependTo
prependTo(target: ByteBuffer, offset: number): ByteBufferPrepends this ByteBuffer to another ByteBuffer. This will overwrite any contents before the specified offset up to the prepended data's length. If there is not enough space available before the specified offset, the backing buffer will be resized and its contents moved accordingly.
Parameters
- target:
ByteBufferTarget ByteBuffer - offset:
numberOffset to prepend at. Will use and decrease ByteBuffer#offset by the number of bytes prepended if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1208
readBytes
readBytes(length: number, offset: number): ByteBufferReads the specified number of bytes.
Parameters
- length:
numberNumber of bytes to read - offset:
numberOffset to read from. Will use and increase ByteBuffer#offset bylengthif omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:274
readFloat32
readFloat32(offset: number): numberReads a 32bit float.
Parameters
- offset:
numberOffset to read from. Will use and increase ByteBuffer#offset by4if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:737
readFloat64
readFloat64(offset: number): numberReads a 64bit float.
Parameters
- offset:
numberOffset to read from. Will use and increase ByteBuffer#offset by8if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:802
readInt16
readInt16(offset: number): numberReads a 16bit signed integer.
Parameters
- offset:
numberOffset to read from. Will use and advance ByteBuffer#offset by2if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:478
readInt32
readInt32(offset: number): numberReads a 32bit signed integer.
Parameters
- offset:
numberOffset to read from. Will use and increase ByteBuffer#offset by4if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:613
readInt64
readInt64(offset: number): bigintReads a 64bit signed integer.
Parameters
- offset:
numberOffset to read from. Will use and increase ByteBuffer#offset by8if omitted.
Return Type
bigint
Defined in: packages/bytebuffer/index.ts:1371
readInt8
readInt8(offset: number): numberReads an 8bit signed integer.
Parameters
- offset:
numberOffset to read from. Will use and advance ByteBuffer#offset by1if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:344
readUint16
readUint16(offset: number): numberReads a 16bit unsigned integer.
Parameters
- offset:
numberOffset to read from. Will use and advance ByteBuffer#offset by2if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:548
readUint32
readUint32(offset: number): numberReads a 32bit unsigned integer.
Parameters
- offset:
numberOffset to read from. Will use and increase ByteBuffer#offset by4if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:674
readUint64
readUint64(offset: number): bigintReads a 64bit unsigned integer.
Parameters
- offset:
numberOffset to read from. Will use and increase ByteBuffer#offset by8if omitted.
Return Type
bigint
Defined in: packages/bytebuffer/index.ts:1434
readUint8
readUint8(offset: number): numberReads an 8bit unsigned integer.
Parameters
- offset:
numberOffset to read from. Will use and advance ByteBuffer#offset by1if omitted.
Return Type
number
Defined in: packages/bytebuffer/index.ts:408
readVarint32
readVarint32(): numberReturn Type
number
readVarint32(offset: number): number | { length: number; value: number }Parameters
- offset:
number
Return Type
number | { length: number; value: number }
Defined in: packages/bytebuffer/varint32.ts:6, packages/bytebuffer/varint32.ts:7
readVarint32ZigZag
readVarint32ZigZag(): numberReturn Type
number
readVarint32ZigZag(offset: number): { length: number; value: number }Parameters
- offset:
number
Return Type
{ length: number; value: number }
readVarint32ZigZag(offset: number): number | { length: number; value: number }Parameters
- offset:
number
Return Type
number | { length: number; value: number }
Defined in: packages/bytebuffer/varint32.ts:9, packages/bytebuffer/varint32.ts:10, packages/bytebuffer/varint32.ts:11
readVarint64
readVarint64(): bigintReturn Type
bigint
readVarint64(offset: number): { length: number; value: bigint }Parameters
- offset:
number
Return Type
{ length: number; value: bigint }
readVarint64(offset: number): bigint | { length: number; value: bigint }Reads a 64bit base 128 variable-length integer. Requires bigint.js.
Parameters
- offset:
numberOffset to read from. Will use and increase ByteBuffer#offset by the number of bytes read if omitted.
Return Type
bigint | { length: number; value: bigint }
Defined in: packages/bytebuffer/varint64.ts:15, packages/bytebuffer/varint64.ts:16, packages/bytebuffer/varint64.ts:26
readVarint64ZigZag
readVarint64ZigZag(offset: number): bigint | { length: number; value: number | bigint }Parameters
- offset:
number
Return Type
bigint | { length: number; value: number | bigint }
Defined in: packages/bytebuffer/varint64.ts:36
remaining
remaining(): numberGets the number of remaining readable bytes. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit, so this returns limit - offset.
Return Type
number
Defined in: packages/bytebuffer/index.ts:1219
reset
reset(): ByteBufferResets this ByteBuffer's ByteBuffer#offset. If an offset has been marked through ByteBuffer#mark before, offset will be set to ByteBuffer#markedOffset, which will then be discarded. If no offset has been marked, sets offset = 0.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1231
resize
resize(capacity: number): ByteBufferResizes this ByteBuffer to be backed by a buffer of at least the given capacity. Will do nothing if already that large or larger.
Parameters
- capacity:
numberCapacity required
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1250
reverse
reverse(begin: undefined | number, end: undefined | number): ByteBufferReverses this ByteBuffer's contents.
Parameters
- begin:
undefined | numberOffset to start at, defaults to ByteBuffer#offset - end:
undefined | numberOffset to end at, defaults to ByteBuffer#limit
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1272
skip
skip(length: number): ByteBufferSkips the next length bytes. This will just advance
Parameters
- length:
numberNumber of bytes to skip. May also be negative to move the offset back.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1294
slice
slice(begin: number, end: number): ByteBufferSlices this ByteBuffer by creating a cloned instance with offset = begin and limit = end.
Parameters
- begin:
numberBegin offset, defaults to ByteBuffer#offset. - end:
numberEnd offset, defaults to ByteBuffer#limit.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1314
toBuffer
toBuffer(forceCopy: boolean): ArrayBufferReturns a copy of the backing buffer that contains this ByteBuffer's contents. Contents are the bytes between ByteBuffer#offset and ByteBuffer#limit.
Parameters
- forceCopy:
booleanIftruereturns a copy, otherwise returns a view referencing the same memory if possible. Defaults tofalse
Return Type
ArrayBuffer
Defined in: packages/bytebuffer/index.ts:1464
toHex
toHex(begin: undefined | number, end: undefined | number): stringParameters
- begin:
undefined | number - end:
undefined | number
Return Type
string
Defined in: packages/bytebuffer/hex.ts:5
writeFloat32
writeFloat32(value: number, offset: number): ByteBufferWrites a 32bit float.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by4if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:703
writeFloat64
writeFloat64(value: number, offset: number): ByteBufferWrites a 64bit float.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by8if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:768
writeInt16
writeInt16(value: number, offset: number): ByteBufferWrites a 16bit signed integer.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and advance ByteBuffer#offset by2if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:440
writeInt32
writeInt32(value: number, offset: number): ByteBufferWrites a 32bit signed integer.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by4if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:580
writeInt64
writeInt64(value: number | bigint, offset: number): ByteBufferWrites a 64bit signed integer.
Parameters
- value:
number | bigintValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by8if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1337
writeInt8
writeInt8(value: number, offset: number): ByteBufferWrites an 8bit signed integer.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and advance ByteBuffer#offset by1if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:309
writeUint16
writeUint16(value: number, offset: number): ByteBufferWrites a 16bit unsigned integer.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and advance ByteBuffer#offset by2if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:510
writeUint32
writeUint32(value: number, offset: number): ByteBufferWrites a 32bit unsigned integer.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by4if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:640
writeUint64
writeUint64(value: number | bigint, offset: number): ByteBufferWrites a 64bit unsigned integer.
Parameters
- value:
number | bigintValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by8if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:1399
writeUint8
writeUint8(value: number, offset: number): ByteBufferWrites an 8bit unsigned integer.
Parameters
- value:
numberValue to write - offset:
numberOffset to write to. Will use and advance ByteBuffer#offset by1if omitted.
Return Type
ByteBuffer
Defined in: packages/bytebuffer/index.ts:373
writeVarint32
writeVarint32(value: number, offset: number): number | ByteBufferParameters
- value:
number - offset:
number
Return Type
number | ByteBuffer
Defined in: packages/bytebuffer/varint32.ts:5
writeVarint32ZigZag
writeVarint32ZigZag(value: number, offset: number): number | ByteBufferParameters
- value:
number - offset:
number
Return Type
number | ByteBuffer
Defined in: packages/bytebuffer/varint32.ts:8
writeVarint64
writeVarint64(value: number | bigint, offset: number): number | ByteBufferWrites a 64bit base 128 variable-length integer.
Parameters
- value:
number | bigintValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by the number of bytes written if omitted.
Return Type
number | ByteBuffer
Defined in: packages/bytebuffer/varint64.ts:14
writeVarint64ZigZag
writeVarint64ZigZag(value: number | bigint, offset: number): number | ByteBufferWrites a zig-zag encoded 64bit base 128 variable-length integer.
Parameters
- value:
number | bigintValue to write - offset:
numberOffset to write to. Will use and increase ByteBuffer#offset by the number of bytes written if omitted.
Return Type
number | ByteBuffer
Defined in: packages/bytebuffer/varint64.ts:35