com.limegroup.gnutella.routing
Class PatchTableMessage
java.lang.Object
com.limegroup.gnutella.messages.Message
com.limegroup.gnutella.routing.RouteTableMessage
com.limegroup.gnutella.routing.PatchTableMessage
- All Implemented Interfaces:
- java.lang.Comparable, java.io.Serializable
- public class PatchTableMessage
- extends RouteTableMessage
The PATCH route table update message. This class is as simple as possible.
For example, the getData() method returns the raw bytes of the message,
requiring the caller to call the getEntryBits() method to calculate the i'th
patch value. (Note that this is trivial if getEntryBits() returns 8.) This
is by intention, as patches are normally split into several
PatchTableMessages.
- See Also:
- Serialized Form
Fields inherited from class com.limegroup.gnutella.messages.Message |
F_PING, F_PING_REPLY, F_PUSH, F_QUERY, F_QUERY_REPLY, F_ROUTE_TABLE_UPDATE, F_VENDOR_MESSAGE, F_VENDOR_MESSAGE_STABLE, N_MULTICAST, N_TCP, N_UDP, N_UNKNOWN, RECORD_STATS, SOFT_MAX |
Constructor Summary |
protected |
PatchTableMessage(byte[] guid,
byte ttl,
byte hops,
byte[] payload)
Creates a new PATCH variant with data read from the network. |
|
PatchTableMessage(short sequenceNumber,
short sequenceSize,
byte compressor,
byte entryBits,
byte[] dataSrc,
int dataSrcStart,
int dataSrcStop)
Creates a new PATCH variant from scratch, with TTL 1. |
Methods inherited from class com.limegroup.gnutella.messages.Message |
compareTo, getCreationTime, getFunc, getGUID, getHops, getLength, getNetwork, getPriority, getTotalLength, getTTL, hop, isMulticast, isTCP, isUDP, isUnknownNetwork, makeGuid, read, read, read, read, read, readNullTerminatedBytes, repOk, setGUID, setHops, setPriority, setTTL, updateLength, write, writeGemExtension, writeGemExtension, writeGemExtensions |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
COMPRESSOR_NONE
public static final byte COMPRESSOR_NONE
- See Also:
- Constant Field Values
COMPRESSOR_DEFLATE
public static final byte COMPRESSOR_DEFLATE
- See Also:
- Constant Field Values
PatchTableMessage
public PatchTableMessage(short sequenceNumber,
short sequenceSize,
byte compressor,
byte entryBits,
byte[] dataSrc,
int dataSrcStart,
int dataSrcStop)
- Creates a new PATCH variant from scratch, with TTL 1. The patch data is
copied from dataSrc[datSrcStart...dataSrcStop-1], inclusive.
- See Also:
RouteTableMessage
PatchTableMessage
protected PatchTableMessage(byte[] guid,
byte ttl,
byte hops,
byte[] payload)
throws BadPacketException
- Creates a new PATCH variant with data read from the network.
The first byte is guaranteed to be PATCH_VARIANT.
- Throws:
BadPacketException
- the remaining values in payload are not
well-formed, e.g., because it's the wrong length, the sequence size
is less than the sequence number, etc.
writePayloadData
protected void writePayloadData(java.io.OutputStream out)
throws java.io.IOException
- Specified by:
writePayloadData
in class RouteTableMessage
- Throws:
java.io.IOException
getSequenceNumber
public short getSequenceNumber()
getSequenceSize
public short getSequenceSize()
getCompressor
public byte getCompressor()
getEntryBits
public byte getEntryBits()
getData
public byte[] getData()
recordDrop
public void recordDrop()
- Description copied from class:
Message
- Records the dropping of this message in statistics.
- Specified by:
recordDrop
in class Message
toString
public java.lang.String toString()
- Overrides:
toString
in class Message