readLPBuffer method

ByteBuf readLPBuffer([
  1. Endian? endian
])

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:

Implementation

ByteBuf readLPBuffer([Endian? endian]) {
  int length = readInt32(endian);
  var bytes = readBytes(length);
  return bytes.asWrappedBuffer;
}