Package net.i2p.client.datagram
Class Datagram3
java.lang.Object
net.i2p.client.datagram.Datagram3
Class for creating and loading I2P repliable datagrams version 3.
Ref: Proposal 163
+----+----+----+----+----+----+----+----+ | | + fromHash + | | + + | | +----+----+----+----+----+----+----+----+ | flags | options (optional) | +----+----+ + ~ ~ ~ ~ +----+----+----+----+----+----+----+----+ | | ~ payload ~ ~ ~ | | +----+----+----+----+----+----+----+----+
- Since:
- 0.9.66
-
Method Summary
Modifier and TypeMethodDescriptionGet the options of an I2P repliable datagram (previously loaded with the load() method), if anybyte[]
Get the payload carried by an I2P repliable datagram (previously loaded with the load() method)Get the sender of an I2P repliable datagram (previously loaded with the load() method)static Datagram3
load
(I2PAppContext ctx, I2PSession session, byte[] dgram) Load an I2P repliable datagram3.static byte[]
make
(I2PAppContext ctx, I2PSession session, byte[] payload) Make a repliable I2P datagram3 containing the specified payload.static byte[]
make
(I2PAppContext ctx, I2PSession session, byte[] payload, Properties options) Make a repliable I2P datagram3 containing the specified payload.
-
Method Details
-
make
public static byte[] make(I2PAppContext ctx, I2PSession session, byte[] payload) throws DataFormatException Make a repliable I2P datagram3 containing the specified payload.- Parameters:
payload
- non-null Bytes to be contained in the I2P datagram.- Returns:
- non-null, throws on all errors
- Throws:
DataFormatException
- if payload is too big
-
make
public static byte[] make(I2PAppContext ctx, I2PSession session, byte[] payload, Properties options) throws DataFormatException Make a repliable I2P datagram3 containing the specified payload.- Parameters:
payload
- non-null Bytes to be contained in the I2P datagram.options
- may be null- Returns:
- non-null, throws on all errors
- Throws:
DataFormatException
- if payload is too big
-
load
public static Datagram3 load(I2PAppContext ctx, I2PSession session, byte[] dgram) throws DataFormatException Load an I2P repliable datagram3.- Parameters:
dgram
- non-null I2P repliable datagram to be loaded- Returns:
- non-null, throws on all errors
- Throws:
DataFormatException
- If there is an error in the datagram format
-
getPayload
public byte[] getPayload()Get the payload carried by an I2P repliable datagram (previously loaded with the load() method)- Returns:
- A byte array containing the datagram payload
-
getSender
Get the sender of an I2P repliable datagram (previously loaded with the load() method)- Returns:
- The Hash of the Destination of the I2P repliable datagram sender
-
getOptions
Get the options of an I2P repliable datagram (previously loaded with the load() method), if any- Returns:
- options or null
-