net.i2p.sam
public abstract class SAMMessageSession extends Object
Modifier and Type | Class and Description |
---|---|
class |
SAMMessageSession.SAMMessageSessionHandler
SAM message-based session handler, running in its own thread
|
Modifier | Constructor and Description |
---|---|
protected |
SAMMessageSession(InputStream destStream,
Properties props)
Initialize a new SAM message-based session.
|
protected |
SAMMessageSession(String dest,
Properties props)
Initialize a new SAM message-based session.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close a SAM message-based session.
|
Destination |
getDestination()
Get the SAM message-based session Destination.
|
protected I2PSession |
getI2PSession()
Get the I2PSession object used by the SAM message-based session.
|
protected abstract void |
messageReceived(byte[] msg)
Handle a new received message
|
abstract boolean |
sendBytes(String dest,
byte[] data)
Send bytes through a SAM message-based session.
|
protected boolean |
sendBytesThroughMessageSession(String dest,
byte[] data)
Actually send bytes through the SAM message-based session I2PSession
(er...).
|
protected abstract void |
shutDown()
Do whatever is needed to shutdown the SAM session
|
protected SAMMessageSession(String dest, Properties props) throws IOException, DataFormatException, I2PSessionException
dest
- Base64-encoded destination (private key)props
- Properties to setup the I2P sessionIOException
DataFormatException
I2PSessionException
protected SAMMessageSession(InputStream destStream, Properties props) throws IOException, DataFormatException, I2PSessionException
destStream
- Input stream containing the destination keysprops
- Properties to setup the I2P sessionIOException
DataFormatException
I2PSessionException
public Destination getDestination()
public abstract boolean sendBytes(String dest, byte[] data) throws DataFormatException
dest
- Destinationdata
- Bytes to be sentDataFormatException
protected boolean sendBytesThroughMessageSession(String dest, byte[] data) throws DataFormatException
dest
- Destinationdata
- Bytes to be sentDataFormatException
public void close()
protected abstract void messageReceived(byte[] msg)
msg
- Message payloadprotected abstract void shutDown()
protected I2PSession getI2PSession()