net.i2p.sam
public class SAMDatagramSession extends SAMMessageSession
SAMMessageSession.SAMMessageSessionHandler
Modifier and Type | Field and Description |
---|---|
static int |
DGRAM_SIZE_MAX |
protected SAMDatagramReceiver |
recv |
Constructor and Description |
---|
SAMDatagramSession(InputStream destStream,
Properties props,
SAMDatagramReceiver recv)
Create a new SAM DATAGRAM session.
|
SAMDatagramSession(String dest,
Properties props,
SAMDatagramReceiver recv)
Create a new SAM DATAGRAM session.
|
Modifier and Type | Method and Description |
---|---|
protected void |
messageReceived(byte[] msg)
Handle a new received message
|
boolean |
sendBytes(String dest,
byte[] data)
Send bytes through a SAM DATAGRAM session.
|
protected void |
shutDown()
Do whatever is needed to shutdown the SAM session
|
close, getDestination, getI2PSession, sendBytesThroughMessageSession
public static int DGRAM_SIZE_MAX
protected SAMDatagramReceiver recv
public SAMDatagramSession(String dest, Properties props, SAMDatagramReceiver recv) throws IOException, DataFormatException, I2PSessionException
dest
- Base64-encoded destination (private key)props
- Properties to setup the I2P sessionrecv
- Object that will receive incoming dataIOException
DataFormatException
I2PSessionException
public SAMDatagramSession(InputStream destStream, Properties props, SAMDatagramReceiver recv) throws IOException, DataFormatException, I2PSessionException
destStream
- Input stream containing the destination keysprops
- Properties to setup the I2P sessionrecv
- Object that will receive incoming dataIOException
DataFormatException
I2PSessionException
public boolean sendBytes(String dest, byte[] data) throws DataFormatException
sendBytes
in class SAMMessageSession
dest
- Destinationdata
- Bytes to be sentDataFormatException
protected void messageReceived(byte[] msg)
SAMMessageSession
messageReceived
in class SAMMessageSession
msg
- Message payloadprotected void shutDown()
SAMMessageSession
shutDown
in class SAMMessageSession