|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectpeer2me.domain.DataPackage
This class is the super class of the different type of packages that can be sent between nodes in the network. It contains the attributes that are common for all types of data packages. These are the address of the sender and the address(es) to the recipiant(s) of the DataPackage. Currently, there exists three types of data packages.
Field Summary | |
static int |
FILE_PACKAGE
|
static int |
GROUP_SYNC_PACKAGE
|
Log |
log
|
static int |
TEXT_PACKAGE
|
Constructor Summary | |
DataPackage(int type)
Constructor used to create an empty DataPackage object to fill with the parseBytes() method |
|
DataPackage(int type,
Node sender,
java.lang.String[] recipients)
Constructor |
Method Summary | |
java.lang.String[] |
getRecipients()
This method returns all the recipients of this data package |
Node |
getSender()
This method returns the sender of this data package |
int |
getType()
This method returns an int indicating the type of data package |
abstract void |
parseBytes(byte[] data)
This method parses the content of the byte array (byte[]) back into a DataPackage object |
void |
setRecipients(java.lang.String[] recipients)
This method sets the nodes to receive this package |
void |
setSender(Node sender)
This method sets the sender of this data package |
abstract byte[] |
toSendableFormat()
This method transforms this data package into a byte array (byte[]) that is possible to send over a network stream |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public Log log
public static final int GROUP_SYNC_PACKAGE
public static final int TEXT_PACKAGE
public static final int FILE_PACKAGE
Constructor Detail |
public DataPackage(int type, Node sender, java.lang.String[] recipients)
type
- The type specifying the type of data packagesender
- A node object representing the sender noderecipients
- The addresses to the recipients of the data packagepublic DataPackage(int type)
type
- The type of the DataPackageMethod Detail |
public int getType()
public Node getSender()
public void setSender(Node sender)
sender
- The node that sends this packagepublic java.lang.String[] getRecipients()
public void setRecipients(java.lang.String[] recipients)
recipients
- The addresses to the nodes that shall receive this packagepublic abstract byte[] toSendableFormat()
public abstract void parseBytes(byte[] data)
data
- The byte[] containing the data representing the DataPackage object
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |