public class I2PSinkAnywhere extends Object implements Sink
send(net.i2p.data.Destination, byte[]) call, rather than a fixed destination.Supports both repliable and raw datagram modes. When not in raw mode,
data is wrapped with I2PDatagramMaker before sending.
| Modifier and Type | Field and Description |
|---|---|
protected I2PDatagramMaker | maker |
protected boolean | raw |
protected I2PSession | sess |
| Constructor and Description |
|---|
I2PSinkAnywhere(I2PSession sess)Creates a repliable (non-raw) sink for the given session. |
I2PSinkAnywhere(I2PSession sess,
boolean raw)Creates a sink for the given session. |
| Modifier and Type | Method and Description |
|---|---|
void | send(Destination to,
byte[] data)Sends data to the specified destination using default ports. |
void | send(Destination to,
int fromPort,
int toPort,
byte[] data)Sends data to the specified destination using the given ports. |
protected final I2PDatagramMaker maker
protected final boolean raw
protected final I2PSession sess
public I2PSinkAnywhere(I2PSession sess)
sess - the I2P session to send throughpublic I2PSinkAnywhere(I2PSession sess, boolean raw)
sess - the I2P session to send throughraw - true for raw datagrams, false for repliablepublic void send(Destination to, byte[] data)
to - the destination to send todata - the data to sendRuntimeException - if the session is closedpublic void send(Destination to, int fromPort, int toPort, byte[] data)
send in interface Sinkto - the destination to send tofromPort - I2CP source port, 0-65535toPort - I2CP destination port, 0-65535data - the data to sendRuntimeException - if the session is closed