|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.router.tunnel.FragmentedMessage
public class FragmentedMessage
Gather fragments of I2NPMessages at a tunnel endpoint, making them available for reading when complete.
Constructor Summary | |
---|---|
FragmentedMessage(I2PAppContext ctx)
|
Method Summary | |
---|---|
void |
failed()
|
int |
getCompleteSize()
|
(package private) SimpleTimer.TimedEvent |
getExpireEvent()
used in the fragment handler so we can cancel the expire event on success |
int |
getFragmentCount()
|
java.io.InputStream |
getInputStream()
|
long |
getLifetime()
how long has this fragmented message been alive? |
long |
getMessageId()
|
boolean |
getReleased()
|
long |
getReleasedAfter()
|
Hash |
getTargetRouter()
|
TunnelId |
getTargetTunnel()
|
boolean |
isComplete()
have we received all of the fragments? |
static void |
main(java.lang.String[] args)
|
boolean |
receive(long messageId,
byte[] payload,
int offset,
int length,
boolean isLast,
Hash toRouter,
TunnelId toTunnel)
Receive the first fragment and related metadata. |
boolean |
receive(long messageId,
int fragmentNum,
byte[] payload,
int offset,
int length,
boolean isLast)
Receive a followup fragment, though one of these may arrive at the endpoint prior to the fragment # 0. |
(package private) void |
setExpireEvent(SimpleTimer.TimedEvent evt)
|
byte[] |
toByteArray()
|
java.lang.String |
toString()
|
void |
writeComplete(byte[] target,
int offset)
|
void |
writeComplete(java.io.OutputStream out)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FragmentedMessage(I2PAppContext ctx)
Method Detail |
---|
public boolean receive(long messageId, int fragmentNum, byte[] payload, int offset, int length, boolean isLast)
messageId
- what messageId is this fragment a part offragmentNum
- sequence number within the message (must be greater than 1)payload
- data for the fragmentoffset
- index into the payload where the fragment data starts (past headers/etc)length
- how much past the offset should we snag?isLast
- is this the last fragment in the message?public boolean receive(long messageId, byte[] payload, int offset, int length, boolean isLast, Hash toRouter, TunnelId toTunnel)
messageId
- what messageId is this fragment a part ofpayload
- data for the fragmentoffset
- index into the payload where the fragment data starts (past headers/etc)length
- how much past the offset should we snag?isLast
- is this the last fragment in the message?toRouter
- what router is this destined for (may be null)toTunnel
- what tunnel is this destined for (may be null)public long getMessageId()
public Hash getTargetRouter()
public TunnelId getTargetTunnel()
public int getFragmentCount()
SimpleTimer.TimedEvent getExpireEvent()
void setExpireEvent(SimpleTimer.TimedEvent evt)
public boolean isComplete()
public int getCompleteSize()
public long getLifetime()
public boolean getReleased()
public void writeComplete(java.io.OutputStream out) throws java.io.IOException
java.io.IOException
public void writeComplete(byte[] target, int offset)
public byte[] toByteArray()
public long getReleasedAfter()
public void failed()
public java.io.InputStream getInputStream()
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |