ReadWriteExtension extension
Default extensions on ByteBuf for reading and writing data based on the readerIndex and writerIndex.
- on
Methods
-
readBool(
) → bool - Reads the next byte as a bool using 0xFF as true and other values as false at the current readerIndex (inclusive).
-
readFixNumInt64(
[Endian? endian]) → Int64 - Reads the next 8 bytes as a signed integer at the current readerIndex (inclusive).
-
readFloat32(
[Endian? endian]) → double - Reads the next 4 bytes as a floating point number at the current readerIndex (inclusive).
-
readFloat64(
[Endian? endian]) → double - Reads the next 8 bytes as a floating point number at the current readerIndex (inclusive).
-
readInt16(
[Endian? endian]) → int - Reads the next 2 bytes as a signed integer at the current readerIndex (inclusive).
-
readInt32(
[Endian? endian]) → int - Reads the next 4 bytes as a signed integer at the current readerIndex (inclusive).
-
readInt64(
[Endian? endian]) → int - Reads the next 8 bytes as a signed integer at the current readerIndex (inclusive).
-
readInt8(
) → int - Reads the next 1 byte as a signed integer at the current readerIndex (inclusive).
-
readLPBase64(
[Endian? endian]) → Uint8List - Reads a length prepended canonical base64 value at the current readerIndex (inclusive).
-
readLPBuffer(
[Endian? endian]) → ByteBuf - Reads a length prepended buffer at the current readerIndex (inclusive).
-
readLPString(
[Encoding? encoding, Endian? endian]) → String -
Reads a length prepended string encoded by
encoding
at the current readerIndex (inclusive). -
readNullable<
T> (T converter()) → T? -
Reads the first byte to determine if the value is null and executes
converter
if a value is present. -
readUint16(
[Endian? endian]) → int - Reads the next 2 bytes as an unsigned integer at the current readerIndex (inclusive).
-
readUint32(
[Endian? endian]) → int - Reads the next 4 bytes as an unsigned integer at the current readerIndex (inclusive).
-
readUint64(
[Endian? endian]) → int - Reads the next 8 bytes as an unsigned integer at the current readerIndex (inclusive).
-
readUint8(
) → int - Reads the next 1 byte as an unsigned integer at the current readerIndex (inclusive).
-
writeBool(
bool value) → void -
Writes the
value
as a single byte using 0xFF as true and 0x00 as false at the current writerIndex (inclusive). -
writeFixNumInt64(
Int64 value, [Endian? endian]) → void -
Writes the
value
as a 8 byte long signed integer at the current writerIndex (inclusive). -
writeFloat32(
double value, [Endian? endian]) → void -
Writes the
value
as a 4 byte long floating point number at the current writerIndex (inclusive). -
writeFloat64(
double value, [Endian? endian]) → void -
Writes the
value
as a 8 byte long floating point number at the current writerIndex (inclusive). -
writeInt16(
int value, [Endian? endian]) → void -
Writes the
value
as a 2 byte long signed integer at the current writerIndex (inclusive). -
writeInt32(
int value, [Endian? endian]) → void -
Writes the
value
as a 4 byte long signed integer at the current writerIndex (inclusive). -
writeInt64(
int value, [Endian? endian]) → void -
Writes the
value
as a 8 byte long signed integer at the current writerIndex (inclusive). -
writeInt8(
int value) → void -
Writes the
value
as a 1 byte long signed integer at the current writerIndex (inclusive). -
writeLPBase64(
Uint8List bytes, [Endian? endian]) → void -
Encodes the
bytes
using canonical base64 and writes the resulting data prefixed by the length of the resulting buffer as an int32 at the current writerIndex (inclusive) using writeLPString. -
writeLPBuffer(
ByteBuf buffer, [Endian? endian]) → void -
Writes the readable data of the
buffer
, prefixed by the amount of readable bytes at the writerIndex (inclusive). -
writeLPString(
String value, [Encoding? encoding, Endian? endian]) → void -
Encodes the
value
usingencoding
and writes the resulting data prefixed by the length of the resulting buffer as an int32 at the current writerIndex (inclusive). -
writeNullable<
T> (T? value, dynamic converter(T)) → void -
Store nullability information about
value
in a single byte, representing null as 0x00 and any value as 0xFF and executesconverter
if the value is not null. -
writeUint16(
int value, [Endian? endian]) → void -
Writes the
value
as a 2 byte long unsigned integer at the current writerIndex (inclusive). -
writeUint32(
int value, [Endian? endian]) → void -
Writes the
value
as a 4 byte long unsigned integer at the current writerIndex (inclusive). -
writeUint64(
int value, [Endian? endian]) → void -
Writes the
value
as a 8 byte long unsigned integer at the current writerIndex (inclusive). -
writeUint8(
int value) → void -
Writes the
value
as a 1 byte long unsigned integer at the current writerIndex (inclusive).