public class MessageWrapper
extends java.lang.Object
Constructor and Description |
---|
MessageWrapper(MessageItem item,
int messageID) |
Modifier and Type | Method and Description |
---|---|
boolean |
ack(int start,
int end) |
boolean |
ack(int start,
int end,
BasePeerNode pn)
Mark the given range as received.
|
boolean |
allSent()
Returns
true if all the data of this MessageWrapper has been sent, and false otherwise. |
int |
getLength() |
freenet.node.MessageFragment |
getMessageFragment(int maxLength)
Returns a
MessageFragment with a length of maxLength or
less, or null if there is nothing to send. |
int |
getMessageID() |
int |
getPriority() |
boolean |
isFirstFragment() |
boolean |
isFragmented(int length) |
int |
lost(int start,
int end)
Marks the given range of bytes as lost and returns the number of bytes
that were lost.
|
void |
onDisconnect() |
void |
onSent(int start,
int end,
int overhead,
BasePeerNode pn)
Called when data from this
MessageWrapper is sent to another node. |
public MessageWrapper(MessageItem item, int messageID)
public boolean ack(int start, int end)
public boolean ack(int start, int end, BasePeerNode pn)
start
- the first byte to be markedend
- the last byte to be markedpn
- just for loggingpublic int lost(int start, int end)
start
- The first byte that is lostend
- The last byte that is lostpublic int getMessageID()
public int getLength()
public boolean isFragmented(int length)
public int getPriority()
public boolean isFirstFragment()
public freenet.node.MessageFragment getMessageFragment(int maxLength)
MessageFragment
with a length of maxLength
or
less, or null
if there is nothing to send. Ranges that have been
returned by this function, and not marked as lost, and data that has been
acked is never returned.maxLength
- The maximum length of the returned fragmentMessageFragment
with a length of maxLength
or lesspublic void onDisconnect()
public boolean allSent()
true
if all the data of this MessageWrapper
has been sent, and false
otherwise.true
if all the data of this MessageWrapper
has been sentpublic void onSent(int start, int end, int overhead, BasePeerNode pn)
MessageWrapper
is sent to another node.start
- The first byte that is sentend
- The last byte that is sentoverhead
- The number of extra bytes used to send this message