|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.mindtree.techworks.insight.remoteprotocol.spi.PacketDataContent
public abstract class PacketDataContent
Abstract class representing the data content in the
DataPacket. This
class contains the byte representation of the data. Specific
subclasses may provide methods to access the data in a friendlier way. Unless
an object of this class is an instance of NullMessageDataContent,
setting null data is not allowed.
DataPacket,
PacketHeader,
Serialized Form| Field Summary | |
|---|---|
static int |
MAX_PACKET_DATA_SIZE
The maximum number of bytes a data packet can have. |
protected MessageType |
messageType
Identifies the type of this message packet. |
protected byte[] |
packetData
Packet Data without the header |
| Constructor Summary | |
|---|---|
PacketDataContent()
Creates an instance of PacketDataContent object |
|
PacketDataContent(byte[] completePacketData,
PacketHeader packetHeader)
Creates an instance of PacketDataContent object. |
|
| Method Summary | |
|---|---|
protected void |
checkPacketDataSize(byte[] dataToSet)
Checks the packet data size and ensures that this is less than MAX_PACKET_DATA_SIZE. |
int |
getLength()
Returns the length of the data in the packet. |
MessageType |
getMessageType()
Returns the messageType |
byte[] |
getPacketData()
Returns the packetData. |
void |
setMessageType(MessageType messageType)
Sets the messageType field |
void |
setPacketData(byte[] packetData)
Sets the packetData field |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int MAX_PACKET_DATA_SIZE
protected byte[] packetData
protected MessageType messageType
| Constructor Detail |
|---|
public PacketDataContent()
public PacketDataContent(byte[] completePacketData,
PacketHeader packetHeader)
The byte [] passed in should be complete data for the
packet including the header. The constructor will start reading data for
this packet leaving the bytes required for the Header.
Note: Using this constructor requires that certain fields regarding this packet be already set in the header. In particular the following fields in the header are used:
completePacketData - packetHeader - | Method Detail |
|---|
public int getLength()
public MessageType getMessageType()
public void setMessageType(MessageType messageType)
messageType - The messageType to set.public byte[] getPacketData()
public void setPacketData(byte[] packetData)
throws RemoteProtocolException
packetData - The packetData to set.
PacketDataSizeOverLimitsException - This may be thrown if the packet data is over limit
RemoteProtocolException - This may be thrown by a subclass overriding this method to
indicate some invalid data.
protected void checkPacketDataSize(byte[] dataToSet)
throws PacketDataSizeOverLimitsException
MAX_PACKET_DATA_SIZE. This method is
called before setting packet data. If subclasses override the
#setPacketData(byte[]) method, then they should call this
method before setting the data.
dataToSet - Checks the data to set
PacketDataSizeOverLimitsException - If the data size is over the allowed limit
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||