|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectist.palcom.mal.Message
public class Message
Message implement the common message format.
| Field Summary | |
|---|---|
static byte |
TYPE_MULTIPART
|
static byte |
TYPE_NONE
Special value used when there is no data |
static byte |
TYPE_SINGLE
|
| Constructor Summary | |
|---|---|
Message()
|
|
Message(byte dataType)
|
|
Message(byte[] data)
Create a message of TYPE_SINGLE with the given data. |
|
Message(byte[] data,
int offset,
int dataLength)
Create a message of TYPE_SINGLE with the given data. |
|
Message(byte dataType,
byte[] data)
|
|
Message(byte dataType,
byte[] data,
int offset,
int dataLength)
|
|
Message(MessageHeaderNode node)
Create a message of type TYPE_NONE containing only a message header node. |
|
Message(MessageHeaderNode node,
byte[] rawData)
Create a message of type TYPE_NONE containing a message header node and a byte array with all the data unhandled. |
|
| Method Summary | |
|---|---|
void |
addPart(Message part)
|
Message |
getCopy()
|
byte[] |
getData()
|
int |
getDataLength()
Returns the length of the data in the message (zero if there is no data). |
LinkedList |
getHeaderNodes()
|
int |
getHeaderNodesLength()
Get the length of all the current header nodes in the message. |
int |
getNodeAndDataLength()
Returns the length of the data including the header part in the message. |
int |
getNumberOfParts()
|
Message |
getPart(int index)
|
byte[] |
getRawData()
|
java.lang.String |
getReceiverDeviceID()
Returns the receiver deviceID. |
Selector |
getReceiverSelector()
Returns the receiver selector. |
URL |
getReceiverURL()
Returns the receiver URL (protocol-specific URL), or null if it has not been set. |
java.lang.String |
getSenderDeviceID()
Returns the sender deviceID. |
Selector |
getSenderSelector()
Returns the sender selector. |
URL |
getSenderURL()
Returns the sender URL (protocol-specific URL), or null if it has not been set. |
int |
getTotalLength()
Returns the total length of the message, including the length of the header with length and type. |
byte |
getType()
Returns the data type of the message. |
void |
insertHeaderNodeAfter(MessageHeaderNode newNode,
MessageHeaderNode linkedNode)
Insert a message header node after the specified node into the linked list with nodes related to this message. |
void |
insertHeaderNodeFirst(MessageHeaderNode hNode)
Insert a message header node first in the linked list with nodes related to this message. |
void |
insertHeaderNodeLast(MessageHeaderNode hNode)
Insert a message header node last in the linked list with nodes related to this message. |
static Message |
parse(byte[] buffer,
int offset,
int length)
Factory method for parsing a Message from a byte array. |
void |
removePart(Message part)
|
void |
setData(byte[] data)
Sets the data of the message (used when the data type is of TYPE_SINGLE). |
void |
setHeaderNodes(LinkedList headerNodes)
Set the linked list with message header nodes to the specified list. |
void |
setReceiverDeviceID(java.lang.String deviceID)
Sets the receiver deviceID of this message. |
void |
setReceiverSelector(Selector selector)
Sets the receiver selector. |
void |
setReceiverURL(URL url)
Sets the receiver URL of this message (protocol-specific URL, set when a message has been received over the network). |
void |
setSenderDeviceID(java.lang.String deviceID)
Sets the sender deviceID of this message. |
void |
setSenderSelector(Selector selector)
Sets the sender selector of this message. |
void |
setSenderURL(URL url)
Sets the sender URL of this message (protocol-specific URL, set when a message has been received over the network). |
int |
write(byte[] buffer,
int offset)
Write the message to a buffer, starting at index offset. |
protected int |
writeData(byte[] buffer,
int offset)
Write the data of the message to buffer, starting at index offset in buffer. |
int |
writeDataNodeToBuffer(byte[] buffer,
int offset)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final byte TYPE_NONE
public static final byte TYPE_SINGLE
public static final byte TYPE_MULTIPART
| Constructor Detail |
|---|
public Message()
public Message(MessageHeaderNode node,
byte[] rawData)
public Message(MessageHeaderNode node)
public Message(byte[] data)
public Message(byte[] data,
int offset,
int dataLength)
public Message(byte dataType)
public Message(byte dataType,
byte[] data)
public Message(byte dataType,
byte[] data,
int offset,
int dataLength)
| Method Detail |
|---|
public int getDataLength()
public int getNodeAndDataLength()
public int getTotalLength()
public int getHeaderNodesLength()
public byte getType()
public byte[] getData()
public void setData(byte[] data)
public byte[] getRawData()
public int getNumberOfParts()
public Message getPart(int index)
public void addPart(Message part)
public void removePart(Message part)
public void setHeaderNodes(LinkedList headerNodes)
headerNodes - LinkedList to setpublic void insertHeaderNodeLast(MessageHeaderNode hNode)
hNode - MessageHeaderNode to insert
public void insertHeaderNodeAfter(MessageHeaderNode newNode,
MessageHeaderNode linkedNode)
newNode - MessageHeaderNode to insertlinkedNode - MessageHeaderNode to insert afterpublic void insertHeaderNodeFirst(MessageHeaderNode hNode)
hNode - MessageHeaderNode to insertpublic LinkedList getHeaderNodes()
public java.lang.String getSenderDeviceID()
public void setSenderDeviceID(java.lang.String deviceID)
public Selector getSenderSelector()
public void setSenderSelector(Selector selector)
public java.lang.String getReceiverDeviceID()
public void setReceiverDeviceID(java.lang.String deviceID)
public Selector getReceiverSelector()
public void setReceiverSelector(Selector selector)
public URL getSenderURL()
public void setSenderURL(URL url)
public URL getReceiverURL()
public void setReceiverURL(URL url)
public int write(byte[] buffer,
int offset)
java.lang.IndexOutOfBoundsException - if the buffer is too small.
public int writeDataNodeToBuffer(byte[] buffer,
int offset)
protected int writeData(byte[] buffer,
int offset)
public Message getCopy()
public static Message parse(byte[] buffer,
int offset,
int length)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||