|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--edu.UCL.xmiddle.controller.DataPacket
This class represents a data packet, either received from or being sent to another host.
Data| Field Summary |
| Fields inherited from interface edu.UCL.xmiddle.framework.controller.Data |
RECEIVED, TO_SEND |
| Constructor Summary | |
DataPacket(Host host,
boolean type,
byte[] data)
Creates a new DataPacket |
|
DataPacket(Host host,
boolean type,
org.w3c.dom.Node data)
Creates a new DataPacket |
|
DataPacket(Host host,
boolean type,
java.lang.String data)
Creates a new DataPacket |
|
| Method Summary | |
void |
appendData(byte[] data)
Append the given information to the current data. |
void |
appendData(byte[] data,
int offset,
int length)
Append the given information to the current data. |
void |
appendData(org.w3c.dom.Node data)
Append the given information to the current data. |
void |
appendData(java.lang.String data)
Append the given information to the current data. |
java.lang.Object |
getCalculatedCheck()
Returns the check that is calculated from the data. |
java.lang.Object |
getCheck()
Retutns the check that is bound with the data. |
byte[] |
getData()
Returns the data of the packet |
byte[][] |
getData(int segmentSize)
Returns the data contained as numbered segments of the given size |
Host |
getHost()
Returns the host to which this package is targetted or from which this packet was received |
boolean |
getType()
Retrieves the type of the packet |
void |
init(Host host,
boolean type)
|
void |
prependData(byte[] data)
Prepend the given information to the current data. |
void |
prependData(byte[] data,
int offset,
int length)
DPrepend the given information to the current data. |
void |
prependData(org.w3c.dom.Node data)
Prepend the given information to the current data. |
void |
prependData(java.lang.String data)
Prepend the given information to the current data. |
void |
setData(byte[] data)
Sets the data that this packet contains |
void |
setData(byte[] data,
int offset,
int length)
Sets the data that this packet contains |
void |
setData(org.w3c.dom.Node data)
Sets the data that this packet contains |
void |
setData(java.lang.String data)
Sets the data that this packet contains |
void |
setHost(Host host)
Sets the host to which this packet is destined to. |
void |
setType(boolean type)
Sets the type of the packet. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DataPacket(Host host,
boolean type,
byte[] data)
DataPacket
host - a Host valuetype - either TO_SEND or RECEIVEDdata - a byte[] value
public DataPacket(Host host,
boolean type,
java.lang.String data)
DataPacket
host - a Host valuetype - either TO_SEND or RECEIVEDdata - a String value
public DataPacket(Host host,
boolean type,
org.w3c.dom.Node data)
DataPacket
host - a Host valuetype - either TO_SEND or RECEIVEDdata - a Node value| Method Detail |
public void setData(byte[] data)
Data
setData in interface Datadata - a byte[] value
public void setData(byte[] data,
int offset,
int length)
Data
setData in interface Datadata - a byte[] valueoffset - from offsetlength - to offset+lengthpublic void setData(java.lang.String data)
Data
setData in interface Datadata - a String value
public void init(Host host,
boolean type)
public byte[] getData()
Data
getData in interface Databyte[] valuepublic void setHost(Host host)
Data
setHost in interface Datahost - is the target host.public Host getHost()
Data
getHost in interface DataHost valuepublic boolean getType()
Data
getType in interface DataTO_SEND or RECEIVEDpublic void setType(boolean type)
DataTO_SEND or RECEIVED
setType in interface Datatype - the type of the packetpublic void setData(org.w3c.dom.Node data)
Data
setData in interface Datadata - a Node valuepublic byte[][] getData(int segmentSize)
Data
getData in interface DatasegmentSize - the maximum size of each segment (in
bytes). The last segment returned could possibly contain less
bytes - It is up to the caller to check this.
public java.lang.Object getCheck()
Data
getCheck in interface DataObject valuepublic java.lang.Object getCalculatedCheck()
DataRECEIVED and getCalculatedCheck()
does not match getCheck then there has been a
transmission error.
getCalculatedCheck in interface DataObject valuepublic void appendData(byte[] data)
Data
appendData in interface Datadata - a byte[] valuepublic void prependData(byte[] data)
Data
prependData in interface Datadata - a byte[] value
public void appendData(byte[] data,
int offset,
int length)
Data
appendData in interface Datadata - a byte[] valueoffset - from offsetlength - to offset+length
public void prependData(byte[] data,
int offset,
int length)
Data
prependData in interface Datadata - a byte[] valueoffset - from offsetlength - to offset+lengthpublic void appendData(java.lang.String data)
Data
appendData in interface Datadata - a String valuepublic void prependData(java.lang.String data)
Data
prependData in interface Datadata - a String valuepublic void appendData(org.w3c.dom.Node data)
Data
appendData in interface Datadata - a Node valuepublic void prependData(org.w3c.dom.Node data)
Data
prependData in interface Datadata - a Node value
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||