@PrivateApi public class PacketIOHelper extends Object
PacketIOHelperis stateful because it tracks where the packet reading from ByteBuffer or writing to ByteBuffer. A
PacketIOHelperinstance should only be used for reading, or only be used for writing. So if you need to read and write at the same time, you need to have 2 instances. A
PacketIOHelperis designed to be reused.
|Constructor and Description|
|Modifier and Type||Method and Description|
Reads the packet data from the supplied
Writes the packet data to the supplied
public boolean writeTo(Packet packet, ByteBuffer dst)
ByteBuffer, up to the buffer's limit. If it returns
false, it should be called again to write the remaining data.
dst- the destination byte buffer
trueif all the packet's data is now written out;
public Packet readFrom(ByteBuffer src)
ByteBuffer. The buffer may not contain the complete packet. If this method returns
false, it should be called again to read more packet data.
src- the source byte buffer
Copyright © 2019 Hazelcast, Inc.. All Rights Reserved.