|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Data.java Data
is the basic element that is sent and
received by the xmiddle networking layer and the Listeners and
Senders. It provides a basic interface for storing and retreiving
data as well as the host from which the packet was received or is
to be sent. Data
also has provisions for binding the
data with a check (CRC/checksum etc - the choice is left to the
implementation) which it can use to find out errors.
Created: Thu Jul 19 16:34:36 2001
Field Summary | |
static boolean |
RECEIVED
Represents a packet which was received. |
static boolean |
TO_SEND
Represents a packet is to be sent |
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 |
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. |
Field Detail |
public static final boolean TO_SEND
public static final boolean RECEIVED
Method Detail |
public void setData(byte[] data)
data
- a byte[]
valuepublic void setData(byte[] data, int offset, int length)
data
- a byte[]
valueoffset
- from offsetlength
- to offset+lengthpublic void setData(java.lang.String data)
data
- a String
valuepublic void setData(org.w3c.dom.Node data)
data
- a Node
valuepublic byte[] getData()
byte[]
valuepublic byte[][] getData(int segmentSize)
segmentSize
- 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 void setHost(Host host)
host
- is the target host.public Host getHost()
Host
valuepublic void setType(boolean type)
TO_SEND
or RECEIVED
type
- the type of the packetpublic boolean getType()
TO_SEND
or RECEIVED
public java.lang.Object getCheck()
Object
valuepublic java.lang.Object getCalculatedCheck()
RECEIVED
and getCalculatedCheck()
does not match getCheck
then there has been a
transmission error.
Object
valuepublic void appendData(byte[] data)
data
- a byte[]
valuepublic void appendData(byte[] data, int offset, int length)
data
- a byte[]
valueoffset
- from offsetlength
- to offset+lengthpublic void appendData(java.lang.String data)
data
- a String
valuepublic void appendData(org.w3c.dom.Node data)
data
- a Node
valuepublic void prependData(byte[] data)
data
- a byte[]
valuepublic void prependData(byte[] data, int offset, int length)
data
- a byte[]
valueoffset
- from offsetlength
- to offset+lengthpublic void prependData(java.lang.String data)
data
- a String
valuepublic void prependData(org.w3c.dom.Node data)
data
- a Node
value
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |