|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectucr.core.Message
Abstract base class for GNUTella messages
Field Summary | |
protected GUID |
guid
|
protected byte |
hops
|
protected Connection |
originatingConnection
|
protected short[] |
payload
|
protected int |
payloadSize
|
(package private) static short |
QUERY
|
(package private) static short |
QUERYREPLY
|
static int |
SIZE
|
(package private) static int |
SIZE_QUERY_PAYLOAD
|
(package private) static int |
SIZE_QUERYREPLY_PAYLOAD
|
(package private) static short |
TRACE
|
(package private) static short |
TRACEREPLY
|
protected byte |
ttl
|
protected short |
type
|
Constructor Summary | |
(package private) |
Message(GUID guid,
int type)
Construct a message with a specific guid |
(package private) |
Message(int type)
Constructs a new message |
(package private) |
Message(short[] rawMessage,
Connection originatingConnection)
Constructs a message from data read from network |
Method Summary | |
(package private) void |
addPayload(byte[] payload)
Add a payload to the message |
(package private) void |
addPayload(short[] payload)
Add a payload to the message |
(package private) byte[] |
getByteArray()
Produces a byte[] suitable for GNUTELLA network |
GUID |
getGUID()
Query the GUID |
int |
getHops()
Get the hop count for this message |
Connection |
getOriginatingConnection()
Get the connection that was the source for this message |
(package private) short[] |
getPayload()
Retrieve the message payload |
int |
getPayloadLength()
Query the payload size for this message |
int |
getTTL()
Get the Time to live for the message |
(package private) int |
getType()
Query the type of message |
(package private) void |
setGUID(GUID guid)
Apply a guid to the message |
void |
setHops(byte hops)
Set the hop count for this message, seven is the recommended maximum |
void |
setTTL(byte ttl)
Set the ttl value for the message |
java.lang.String |
toRawString()
Returns a String containing the flattened message |
java.lang.String |
toString()
String representation of the message |
(package private) boolean |
validatePayloadSize()
Checks validity of a payloads size |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final int SIZE
static final short TRACE
static final short TRACEREPLY
static final short QUERY
static final short QUERYREPLY
static final int SIZE_QUERY_PAYLOAD
static final int SIZE_QUERYREPLY_PAYLOAD
protected Connection originatingConnection
protected GUID guid
protected short type
protected byte ttl
protected byte hops
protected short[] payload
protected int payloadSize
Constructor Detail |
Message(int type)
type
- function typeMessage(GUID guid, int type)
guid
- of the messagetype
- of the messageMessage(short[] rawMessage, Connection originatingConnection)
rawMessage
- bytesMethod Detail |
int getType()
public GUID getGUID()
void setGUID(GUID guid)
guid
- new guidpublic int getTTL()
public void setTTL(byte ttl)
public int getHops()
public void setHops(byte hops)
void addPayload(short[] payload)
payload
- payload for the messagevoid addPayload(byte[] payload)
payload
- payload for the messagepublic int getPayloadLength()
short[] getPayload()
byte[] getByteArray()
boolean validatePayloadSize()
public java.lang.String toString()
public java.lang.String toRawString()
public Connection getOriginatingConnection()
Message
was
not read from the network
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |