public class Payload
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static int |
PAYLOAD_SIZE_POSITION |
protected static int |
PAYLOAD_START_POSITION |
protected RequestResponseCode |
requestResponseCode |
| Modifier | Constructor and Description |
|---|---|
protected |
Payload(byte[] packet)
Constructor used to create a Payload (when no more specific subclasses exists) using packet as parameter.
|
|
Payload(RequestResponseCode requestResponseCode)
Consructor used to create Payload with a payload size of zero using a RRCode.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
checkRequestResponseCode()
Used to check RRCode used is compatible with this class use, or if a more specific subclass is required.
|
protected static int |
getPayloadSize(byte[] packet)
Get payload’s size from a Packet.
|
RequestResponseCode |
getRequestResponseCode()
RRCode getter.
|
protected static void |
setPayloadSize(int size,
byte[] packet)
Set payload’s size in a Packet.
|
protected byte[] |
toPacket()
Returns a byte[] containing Packet with padding.
|
protected RequestResponseCode requestResponseCode
protected static final int PAYLOAD_SIZE_POSITION
protected static final int PAYLOAD_START_POSITION
public Payload(RequestResponseCode requestResponseCode) throws InternalError
requestResponseCode - Request/Response code associated with the payloadInternalErrorprotected Payload(byte[] packet)
throws SizeError,
ProtocolError,
InternalError,
TransmissionError
packet - the full packet receivedProtocolErrorInternalErrorTransmissionErrorSizeErrorprivate void checkRequestResponseCode()
throws InternalError
InternalErrorprotected byte[] toPacket()
throws InternalError
InternalErrorprotected static void setPayloadSize(int size,
byte[] packet)
throws InternalError
size - integer representing payload sizepacket - Packet to be completedInternalErrorprotected static int getPayloadSize(byte[] packet)
throws SizeError
packet - the full Packet receivedSizeErrorpublic RequestResponseCode getRequestResponseCode()