Buffer class
This provides methods to read and write strings, lists and various sized integers on a buffer (implemented as an integer list).
The ints in the backing list must all be 8-bit values. If larger values are entered, behaviour is undefined.
As per mysql spec, numbers here are all unsigned. Which makes things much easier.
Constructors
Properties
Methods
-
canReadMore(
) → bool - Returns true if more data can be read from the buffer, false otherwise.
-
fill(
int numberOfBytes, int value) → void -
Fills the next
numberOfBytes
with the givenvalue
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
readByte(
) → int - Returns a single byte, read from the buffer.
-
readDouble(
) → double -
readFloat(
) → double -
readFromSocket(
RawSocket socket, int count) → int -
Reads up to
count
bytes from thesocket
into the buffer. Returns the number of bytes read. -
readInt16(
) → int - Returns a 16-bit integer, read from the buffer
-
readInt32(
) → int - Returns a 32-bit integer, read from the buffer.
-
readInt64(
) → int - Returns a 64-bit integer, read from the buffer.
-
readLengthCodedBinary(
) → int? - Reads a length coded binary from the buffer. This is specified in the mysql docs. It will read up to nine bytes from the stream, depending on the first byte. Returns an unsigned integer.
-
readLengthCodedString(
) → String? - Returns a length coded string, read from the buffer.
-
readList(
int numberOfBytes) → List< int> -
Returns a list of the given
numberOfBytes
, read from the buffer. -
readNullTerminatedList(
) → List< int> - Reads a null terminated list of ints from the buffer. Returns the list of ints from the buffer, without the terminating zero
-
readNullTerminatedString(
) → String - Reads a null terminated string from the buffer. Returns the string, without a terminating null.
-
readString(
int length) → String -
Reads a string of the given
length
from the buffer. -
readStringToEnd(
) → String - Reads a string from the buffer, terminating when the end of the buffer is reached.
-
readUint16(
) → int - Returns a 16-bit integer, read from the buffer
-
readUint24(
) → int - Returns a 24-bit integer, read from the buffer.
-
readUint32(
) → int - Returns a 32-bit integer, read from the buffer.
-
readUint64(
) → int - Returns a 64-bit integer, read from the buffer.
-
reset(
) → void - Resets the read and write positions markers to the start of the buffer */
-
seek(
int position) → void -
Moves the read marker to the given
position
-
seekWrite(
int position) → void -
Moves the write marker to the given
position
-
skip(
int numberOfBytes) → void -
Moves the read marker forwards by the given
numberOfBytes
-
skipWrite(
int numberOfBytes) → void -
Moves the write marker forwards by the given
numberOfBytes
-
toString(
) → String -
A string representation of this object.
inherited
-
writeByte(
int byte) → void -
Writes a single
byte
to the buffer. -
writeDouble(
double value) → void -
writeFloat(
double value) → void -
writeInt16(
int integer) → void -
Writes a 16 bit
integer
to the buffer. -
writeInt32(
int integer) → void -
Writes a 32 bit
integer
to the buffer. -
writeInt64(
int integer) → void -
Writes a 64 bit
integer
to the buffer. -
writeLengthCodedBinary(
int value) → void - Will write a length coded binary value, once implemented!
-
writeList(
List< int> list) → void -
Writes the give
list
of bytes to the buffer. -
writeNullTerminatedList(
List< int> list) → void -
Writes a null terminated list of ints from the buffer. The given
list
should not contain the terminating zero. -
writeToSocket(
RawSocket socket, int start, int count) → int -
Writes up to
count
bytes to thesocket
from the buffer. Returns the number of bytes written. -
writeUint16(
int integer) → void -
Writes a 16 bit
integer
to the buffer. -
writeUint24(
int integer) → void -
Writes a 24 bit
integer
to the buffer. -
writeUint32(
int integer) → void -
Writes a 32 bit
integer
to the buffer. -
writeUint64(
int integer) → void -
Writes a 64 bit
integer
to the buffer.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
int index) → int -
Returns the int at the specified
index
-
operator []=(
int index, int value) → void -
Sets the int at the specified
index
to the givenvalue
Static Methods
-
debugChars(
Uint8List list) → String -
listChars(
Uint8List list) → String -
measureLengthCodedBinary(
int value) → int