ByteBuf class abstract

Implementers
Available Extensions

Constructors

ByteBuf()

Properties

hashCode int
The hash code for this object.
no setterinherited
isReadable bool
Returns true if there are any readable bytes left.
no setter
isWritable bool
Returns true if there are writeable bytes left.
no setter
listView List<int>
no setter
maxCapacity int
Upper constraint of the buffer capacity.
getter/setter pair
minCapacity int
Lower constraint of the buffer capacity.
getter/setter pair
readableBytes int
Amount of bytes which are readable from the current readerIndex (inclusive).
no setter
readerIndex int
Current reader index.
getter/setter pair
readMarker int
The marker of the readerIndex. Overrides the readerIndex with its value when resetReaderIndex is called.
getter/setter pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
writableBytes int
Amount of free bytes inside the buffer from the current writerIndex (inclusive).
no setter
writeMarker int
The marker of the writerIndex. Overrides the writerIndex with its value when resetWriterIndex is called.
getter/setter pair
writerIndex int
Current writer index.
getter/setter pair

Methods

allocate(int bytes) → void
Allocates/Grows the buffer by bytes inside its own constraints.
array() Uint8List
Copies the whole buffer to a separate Uint8List.
assertReadable(int index, int length) → void
Asserts the writability of the region.
assertWriteable(int index, int length) → void
Asserts the readability of the region.
capacity() int
Current capacity of the buffer
checkReadable(int index, int length) bool
Checks the readability of the region while not taking buffer growth into account. Doesn't throw exceptions.
checkWriteable(int index, int length) bool
Checks the writability of the region while not taking buffer growth into account. Doesn't throw exceptions.
clear() → void
Sets both readerIndex and writerIndex to 0.
createReadMarker() LinkedReadMarker
Creates a read marker which doesn't depend on the buffers own markers.
createWriteMarker() LinkedWriteMarker
Creates a write marker which doesn't depend on the buffers own markers.
discardReadBytes() int
Discards all already read bytes and shifts all contents to the left, so that readerIndex is 0 again. The writerIndex gets decreased by the amount of bytes freed.
ensureWritable(int minWritableBytes) int
Tries to expand the buffer to fit at least minWritableBytes and returns the amount of bytes which were allocated.
getBuffer(int index, int length) ByteBuf
Returns a ByteBuf viewing a region beginning at index with the length of length.
getByte(int index) int
Gets the byte at index.
getByteData(int index, int length) ByteData
Reads length bytes beginning at index (inclusive) as a native ByteData view.
getBytes(int index, int length) Uint8List
Reads length bytes beginning at index (inclusive) into a Uint8List.
isGrowable() bool
Defines if the buffer can expand its capacity insides its own constraints.
markReaderIndex() → void
Sets the readMarker to readerIndex.
markWriterIndex() → void
Sets the writeMarker to writerIndex.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
peekAvailableBytes() Uint8List
Reads all available bytes into a Uint8List without incrementing the reader index.
readAvailableBytes() Uint8List
Reads all available bytes into a Uint8List.
readBuffer(int length) ByteBuf
Returns a ByteBuf viewing a region beginning at readerIndex with the length of length.
readByte() int
Reads the byte at the readerIndex and increments the readerIndex by 1 afterwards.
readByteData(int length) ByteData
Reads length bytes beginning at readerIndex (inclusive) as a native ByteData view and increments readerIndex by length afterwards.
readBytes(int length) Uint8List
Reads the next length bytes at the current readerIndex (inclusive) and increments the readerIndex by length.
resetReaderIndex() → void
Resets the readerIndex to readMarker.
resetWriterIndex() → void
Resets the writerIndex to writeMarker.
setBuffer(int index, ByteBuf buffer) → void
Writes the content of buffer at index (inclusive).
setByte(int index, int byte) → void
Sets the byte at index to byte.
setByteData(int index, int length) ByteData
Returns a writeable native ByteData view of the buffer at index (inclusive) with an length of length.
setBytes(int index, List<int> bytes) → void
Writes the content of bytes at index (inclusive).
toString() String
A string representation of this object.
inherited
updateByte(int index, int byte) → void
Sets the byte at index to byte.
viewBuffer(int index, int length) ByteBuf
Returns a ByteBuf viewing a region beginning at index with the length of length.
viewByteData(int index, int length) ByteData
Creates a native ByteData view at index with the length of length.
writeBuffer(ByteBuf buffer) → void
Writes the content of buffer at the current writerIndex (inclusive) and increments the writerIndex by the length of the buffer.
writeByte(int byte) → void
Write one byte with the value of byte at the writerIndex and increments the writerIndex by 1 afterwards.
writeByteData(int length) ByteData
Returns a length-long native ByteData view beginning at readerIndex (inclusive) and increments the writerIndex by length.
writeBytes(List<int> bytes) → void
Writes the bytes at the current writerIndex (inclusive) and increments the writerIndex by the length of the added bytes.
writeTransactionBuffer(int length) ByteBuf
Gets a length-long writable transaction buffer at the current writerIndex (inclusive) and increments the writerIndex by length.

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](int index) int
Gets the byte at index.
operator []=(int index, int value) → void
Sets the byte at index to value.

Static Methods

create({int? initialCapacity, int? maxCapacity}) ByteBuf
Creates a growable ByteBuf with an initial capacity of initialCapacity and a maximum capacity of maxCapacity. If initialCapacity is not specified, kDefaultByteBufSize is used. If maxCapacity is not specified, kDefaultMaxByteBufSize is used.
createHeap({int? initialCapacity, int? maxCapacity}) → ArrayBuffer
Creates a growable ByteBuf with an initial capacity of initialCapacity and a maximum capacity of maxCapacity. If initialCapacity is not specified, kDefaultByteBufSize is used. If maxCapacity is not specified, kDefaultMaxByteBufSize is used.
fixed(int size) ByteBuf
Creates a fixed-length ByteBuf with a capacity of size.
fromData(List<int> data) ByteBuf
Creates a fixed-length ByteBuf from a int List.
indexOf(ByteBuf haystack, ByteBuf needle) int
Searches for the first occurrence of a needle within a haystack and returns the index of the first occurrence, or -1 if not found.
size(int size) ByteBuf
Creates a growable ByteBuf with an initial capacity of size.