com.liferay.portal.kernel.nio.intraband
Class Datagram
java.lang.Object
com.liferay.portal.kernel.nio.intraband.Datagram
public class Datagram
- extends Object
Represents the communication unit of Intraband.
Encodes/decodes data to/from big-endian byte order data format:
Name | Type | Size(byte) | Offset |
Status Flag | byte | 1 | 0 |
Sequence ID | long | 8 | 1 |
Data Type | byte | 1 | 9 |
Data Size | int | 4 | 10 |
Data Chunk |
byte[] |
${Data Size}
| 14 |
attachment
protected Object attachment
completionHandler
protected CompletionHandler<Object> completionHandler
completionTypes
protected EnumSet<CompletionHandler.CompletionType> completionTypes
expireTime
protected long expireTime
timeout
protected long timeout
createRequestDatagram
public static Datagram createRequestDatagram(byte type,
byte[] data)
createRequestDatagram
public static Datagram createRequestDatagram(byte type,
ByteBuffer dataByteBuffer)
createResponseDatagram
public static Datagram createResponseDatagram(Datagram requestDatagram,
byte[] data)
createResponseDatagram
public static Datagram createResponseDatagram(Datagram requestDatagram,
ByteBuffer byteBuffer)
getDataByteBuffer
public ByteBuffer getDataByteBuffer()
getType
public byte getType()
toString
public String toString()
- Overrides:
toString
in class Object
createACKResponseDatagram
protected static Datagram createACKResponseDatagram(long sequenceId)
createReceiveDatagram
protected static Datagram createReceiveDatagram()
getSequenceId
protected long getSequenceId()
isAckRequest
protected boolean isAckRequest()
isAckResponse
protected boolean isAckResponse()
isRequest
protected boolean isRequest()
isResponse
protected boolean isResponse()
readFrom
protected boolean readFrom(ScatteringByteChannel scatteringByteChannel)
throws IOException
- Throws:
IOException
setAckRequest
protected void setAckRequest(boolean ackRequest)
setSequenceId
protected void setSequenceId(long sequenceId)
writeTo
protected boolean writeTo(GatheringByteChannel gatheringByteChannel)
throws IOException
- Throws:
IOException