GetSetExtension extension
Default extensions on ByteBuf for setting and getting data at specific indices.
- on
Methods
-
getBool(
int index) → bool -
Reads a single byte at
index
and returns true if it is 0xFF and false otherwise. -
getFixNumInt64(
int index, [Endian? endian]) → Int64 -
Writes the
value
to the next 4 bytes atindex
(inclusive).endian
defaults to Endian.big. -
getFloat32(
int index, [Endian? endian]) → double -
Reads the next 4 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getFloat64(
int index, [Endian? endian]) → double -
Reads the next 8 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getInt16(
int index, [Endian? endian]) → int -
Reads the next 2 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getInt32(
int index, [Endian? endian]) → int -
Reads the next 4 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getInt64(
int index, [Endian? endian]) → int -
Reads the next 8 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getInt8(
int index) → int -
getLPBase64(
int index, [Endian? endian]) → Uint8List -
Reads a length-prepended String from the next bytes at
index
(inclusive) using getLPString and converts it to a Uint8List using base64Decode.endian
defaults to Endian.big. -
getLPString(
int index, [Encoding? encoding, Endian? endian]) → String -
Reads a length-prepended string from the next bytes at
index
(inclusive).encoding
defaults to utf8Encoding andendian
defaults to Endian.big. -
getUint16(
int index, [Endian? endian]) → int -
Reads the next 2 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getUint32(
int index, [Endian? endian]) → int -
Reads the next 4 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getUint64(
int index, [Endian? endian]) → int -
Reads the next 8 bytes at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
getUint8(
int index) → int -
Reads the next 1 byte at
index
(inclusive) and returns the value.endian
defaults to Endian.big. -
setBool(
int index, bool value) → void -
Writes the
value
as a single byte using 0xFF as true and 0x00 as false atindex
. -
setFixNumInt64(
int index, Int64 value, [Endian? endian]) → void -
Writes the
value
to the next 8 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setFloat32(
int index, double value, [Endian? endian]) → void -
Writes the
value
to the next 4 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setFloat64(
int index, double value, [Endian? endian]) → void -
Writes the
value
to the next 8 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setInt16(
int index, int value, [Endian? endian]) → void -
Writes the
value
to the next 2 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setInt32(
int index, int value, [Endian? endian]) → void -
Writes the
value
to the next 4 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setInt64(
int index, int value, [Endian? endian]) → void -
Writes the
value
to the next 8 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setInt8(
int index, int value) → void -
Writes the
value
to the next 1 byte atindex
(inclusive).endian
defaults to Endian.big. -
setLPBase64(
int index, Uint8List bytes, [Endian? endian]) → void -
Converts the
bytes
to a String using base64Encode and writes it to the next bytes atindex
(inclusive) using setLPString.endian
defaults to Endian.big. -
setLPString(
int index, String string, [Encoding? encoding, Endian? endian]) → void -
Writes a length-prepended string to the next bytes at
index
(inclusive).encoding
defaults to utf8Encoding andendian
defaults to Endian.big. -
setUint16(
int index, int value, [Endian? endian]) → void -
Writes the
value
to the next 2 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setUint32(
int index, int value, [Endian? endian]) → void -
Writes the
value
to the next 4 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setUint64(
int index, int value, [Endian? endian]) → void -
Writes the
value
to the next 8 bytes atindex
(inclusive).endian
defaults to Endian.big. -
setUint8(
int index, int value) → void -
Writes the
value
to the next 1 byte atindex
(inclusive).endian
defaults to Endian.big.