Javadoc
Reads (at least) one packet and returns the packet length.
buf.position() points to the start of the packet and
buf.limit() point to the end of the packet. There could
be more data from next packet in buf.
It tries to read a full packet with single read call.
Consecutive packets are usually of the same length.