Package net.i2p.client.datagram
Class I2PDatagramMaker
- java.lang.Object
-
- net.i2p.client.datagram.I2PDatagramMaker
-
public final class I2PDatagramMaker extends Object
Class for creating I2P repliable datagrams. Note that objects of this class are NOT THREAD SAFE!- Author:
- human
-
-
Constructor Summary
Constructors Constructor Description I2PDatagramMaker()Construct a new I2PDatagramMaker that is null.I2PDatagramMaker(I2PSession session)Construct a new I2PDatagramMaker that will be able to create I2P repliable datagrams going to be sent through the specified I2PSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]makeI2PDatagram(byte[] payload)Make a repliable I2P datagram containing the specified payload.voidsetI2PDatagramMaker(I2PSession session)Does NOT support LS2 offline keys!
-
-
-
Constructor Detail
-
I2PDatagramMaker
public I2PDatagramMaker(I2PSession session)
Construct a new I2PDatagramMaker that will be able to create I2P repliable datagrams going to be sent through the specified I2PSession. Does NOT support LS2 offline keys!- Parameters:
session- I2PSession used to send I2PDatagrams through- Throws:
IllegalArgumentException- if session has offline keys
-
I2PDatagramMaker
public I2PDatagramMaker()
Construct a new I2PDatagramMaker that is null. Use setI2PDatagramMaker to set the parameters.
-
-
Method Detail
-
setI2PDatagramMaker
public void setI2PDatagramMaker(I2PSession session)
Does NOT support LS2 offline keys!- Parameters:
session- I2PSession used to send I2PDatagrams through- Throws:
IllegalArgumentException- if session has offline keys
-
makeI2PDatagram
public byte[] makeI2PDatagram(byte[] payload)
Make a repliable I2P datagram containing the specified payload. Format is:- Destination (387+ bytes)
- Signature (40+ bytes, type and length as implied by signing key type in the Destination)
- Payload
- Parameters:
payload- non-null Bytes to be contained in the I2P datagram.- Returns:
- null on error
- Throws:
IllegalArgumentException- if payload is too bigIllegalStateException- if Destination signature type unsupported
-
-