Buffer class
Properties
-
buffer
→ dynamic
-
read-only
-
hashCode
→ int
-
The hash code for this object. [...]
read-only, inherited
-
length
→ int
-
Returns the amount of memory allocated for this buffer in bytes. Note that
this does not necessarily reflect the amount of "usable" data within buffer.
read-only
-
runtimeType
→ Type
-
A representation of the runtime type of the object.
read-only, inherited
Methods
-
copy(dynamic target, [int targetStart, int sourceStart, int sourceEnd])
→ bool
-
Copies data from a region of buf to a region in
target
even if the target
memory region overlaps with buf.
-
entries()
→ Iterable<List<int>>
-
Creates and returns an iterator of (index, byte) pairs from the contents
of this buffer.
-
equals(dynamic other)
→ bool
-
Returns
true
if both this and other
buffer have exactly the same bytes,
false
otherwise.
-
fill(dynamic value, [int offset, int end, String encoding])
→ Buffer
-
Fills this buffer with the specified value. If the
offset
and end
are
not given, the entire buffer will be filled.
-
includes(dynamic value, [int byteOffset, String encoding])
→ bool
-
Equivalent to
indexOf() != -1
.
-
indexOf(dynamic value, [int byteOffset, String encoding])
→ int
-
-
keys()
→ Iterable<int>
-
Creates and returns an iterator of keys (indices) in this buffer.
-
lastIndexOf(dynamic value, [int byteOffset, String encoding])
→ int
-
Identical to indexOf, except buffer is searched from back to front.
-
noSuchMethod(Invocation invocation)
→ dynamic
-
Invoked when a non-existent method or property is accessed. [...]
inherited
-
readDoubleBE(int offset, [bool noAssert])
→ num
-
Reads a 64-bit double from this buffer at the specified offset with
specified endian format.
-
readDoubleLE(int offset, [bool noAssert])
→ num
-
Reads a 64-bit double from this buffer at the specified offset with
specified endian format.
-
readFloatBE(int offset, [bool noAssert])
→ num
-
Reads a 32-bit float from this buffer at the specified
offset
with
specified endian format.
-
readFloatLE(int offset, [bool noAssert])
→ num
-
Reads a 32-bit float from this buffer at the specified
offset
with
specified endian format.
-
readInt8(int offset, [bool noAssert])
→ num
-
Reads a signed 8-bit integer from this buffer at the specified
offset
.
-
readInt16BE(int offset, [bool noAssert])
→ num
-
Reads a signed 16-bit integer from this buffer at the specified
offset
with specified endian format.
-
readInt16LE(int offset, [bool noAssert])
→ num
-
Reads a signed 16-bit integer from this buffer at the specified
offset
with specified endian format.
-
readInt32BE(int offset, [bool noAssert])
→ num
-
Reads a signed 32-bit integer from this buffer at the specified
offset
with specified endian format.
-
readInt32LE(int offset, [bool noAssert])
→ num
-
Reads a signed 32-bit integer from this buffer at the specified
offset
with specified endian format.
-
readIntBE(int offset, int byteLength, [bool noAssert])
→ int
-
Reads
byteLength
number of bytes from this buffer at the specified offset
and interprets the result as a two's complement signed value. [...]
-
readIntLE(int offset, int byteLength, [bool noAssert])
→ int
-
Reads
byteLength
number of bytes from this buffer at the specified offset
and interprets the result as a two's complement signed value. [...]
-
readUInt8(int offset, [bool noAssert])
→ num
-
Reads a unsigned 8-bit integer from this buffer at the specified
offset
.
-
readUInt16BE(int offset, [bool noAssert])
→ num
-
Reads a unsigned 16-bit integer from this buffer at the specified
offset
with specified endian format.
-
readUInt16LE(int offset, [bool noAssert])
→ num
-
Reads a unsigned 16-bit integer from this buffer at the specified
offset
with specified endian format.
-
readUInt32BE(int offset, [bool noAssert])
→ num
-
Reads a unsigned 32-bit integer from this buffer at the specified
offset
with specified endian format.
-
readUInt32LE(int offset, [bool noAssert])
→ num
-
Reads a unsigned 32-bit integer from this buffer at the specified
offset
with specified endian format.
-
readUIntBE(int offset, int byteLength, [bool noAssert])
→ int
-
Reads
byteLength
number of bytes from this buffer at the specified offset
and interprets the result as an unsigned integer. [...]
-
readUIntLE(int offset, int byteLength, [bool noAssert])
→ int
-
Reads
byteLength
number of bytes from this buffer at the specified offset
and interprets the result as an unsigned integer. [...]
-
slice([int start, int end])
→ Buffer
-
Returns a new Buffer that references the same memory as the original,
but offset and cropped by the
start
and end
indices.
-
swap16()
→ Buffer
-
Interprets this buffer as an array of unsigned 16-bit integers and swaps
the byte-order in-place.
-
swap32()
→ Buffer
-
Interprets this buffer as an array of unsigned 32-bit integers and swaps
the byte-order in-place.
-
swap64()
→ Buffer
-
Interprets this buffer as an array of 64-bit numbers and swaps
the byte-order in-place.
-
toJSON()
→ dynamic
-
Returns a JSON representation of this buffer.
-
toString([String encoding, int start, int end])
→ String
-
Decodes this buffer to a string according to the specified character
encoding
.
override
-
values()
→ Iterable<int>
-
Creates and returns an iterator for this buffer values (bytes).
-
write(String string, [int offset, int length, String encoding])
→ int
-
Writes string to this buffer at
offset
according to the character
encoding
. Returns number of bytes written.
-
writeDoubleBE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeDoubleLE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeFloatBE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeFloatLE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeInt8(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeInt16BE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeInt16LE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeInt32BE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeInt32LE(num value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeIntBE(num value, int offset, int byteLength, [bool noAssert])
→ int
-
Writes
byteLength
bytes of value at the specified offset
. Supports up
to 48 bits of accuracy.
-
writeIntLE(num value, int offset, int byteLength, [bool noAssert])
→ int
-
Writes
byteLength
bytes of value at the specified offset
. Supports up
to 48 bits of accuracy.
-
writeUInt8(int value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeUInt16BE(int value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeUInt16LE(int value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeUInt32BE(int value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeUInt32LE(int value, int offset, [bool noAssert])
→ int
-
Writes value at the specified
offset
with specified endian format.
Returns offset
plus the number of bytes written.
-
writeUIntBE(num value, int offset, int byteLength, [bool noAssert])
→ int
-
Writes
byteLength
bytes of value at the specified offset
. Supports up
to 48 bits of accuracy.
-
writeUIntLE(num value, int offset, int byteLength, [bool noAssert])
→ int
-
Writes
byteLength
bytes of value at the specified offset
. Supports up
to 48 bits of accuracy.
Operators
-
operator ==(Object other)
→ bool
-
The equality operator. [...]
inherited
Static Properties
-
poolSize
↔ int
-
This is the number of bytes used to determine the size of pre-allocated,
internal Buffer instances used for pooling. [...]
read / write
Static Methods
-
alloc(int size, [dynamic fill, String encoding])
→ Buffer
-
Allocates a new Buffer of size bytes. [...]
-
allocUnsafe(int size)
→ Buffer
-
Allocates a new Buffer of size bytes. [...]
-
allocUnsafeSlow(int size)
→ Buffer
-
Allocates a new Buffer of size bytes. [...]
-
byteLength(dynamic string, [dynamic encoding])
→ Buffer
-
Returns the actual byte length of a string.
-
compare(dynamic buf1, dynamic buf2)
→ int
-
Compares
buf1
to buf2
typically for the purpose of sorting arrays of
Buffer instances.
-
concat(List list, [int totalLength])
→ Buffer
-
Returns a new Buffer which is the result of concatenating all the Buffer
instances in the list together.
-
from(dynamic data, [dynamic arg1, dynamic arg2])
→ Buffer
-
Creates a new Buffer from data.
-
isBuffer(dynamic obj)
→ bool
-
Returns
true
if obj
is a Buffer, false
otherwise.
-
isEncoding(String encoding)
→ bool
-
Returns
true
if encoding
contains a supported character encoding,
or false otherwise.