readLPBuffer method
Reads a length prepended buffer at the current readerIndex (inclusive).
endian
the endianness of the prepending length integer, defaults to kEndianness
which is initialized with Endian.big.
See writeLPBuffer for more details about data structure.
Exceptions:
-
ReadIndexOutOfRangeException if the current reader index is outside of the bounds of the buffer
-
BufferOverreadException if the length of the readerIndex + length is outside of the bounds of the buffer
Implementation
ByteBuf readLPBuffer([Endian? endian]) {
int length = readInt32(endian);
var bytes = readBytes(length);
return bytes.asWrappedBuffer;
}