Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## net.i2p.sam
Class SAMMessageSession

    java.lang.Object
      net.i2p.sam.SAMMessageSession

Direct Known Subclasses:
  SAMDatagramSession, SAMRawSession

    public abstract class SAMMessageSession

extends Object

Base abstract class for SAM message-based sessions.

Author:
  human

Nested Class Summary
`class` | `SAMMessageSession.SAMMessageSessionHandler` SAM message-based session handler, running in its own thread

Constructor Summary
`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.

Method Summary
`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

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### SAMMessageSession

    protected SAMMessageSession(String dest,
                                Properties props)
                         throws IOException,
                                DataFormatException,
                                I2PSessionException

  Initialize a new SAM message-based session.

  Parameters:
    `dest` - Base64-encoded destination (private key)
    `props` - Properties to setup the I2P session
  Throws:
    `IOException`
    `DataFormatException`
    `I2PSessionException`

### SAMMessageSession

    protected SAMMessageSession(InputStream destStream,
                                Properties props)
                         throws IOException,
                                DataFormatException,
                                I2PSessionException

  Initialize a new SAM message-based session.

  Parameters:
    `destStream` - Input stream containing the destination keys
    `props` - Properties to setup the I2P session
  Throws:
    `IOException`
    `DataFormatException`
    `I2PSessionException`

Method Detail

### getDestination

    public Destination getDestination()

  Get the SAM message-based session Destination.

  Returns:
    The SAM message-based session Destination.

### sendBytes

    public abstract boolean sendBytes(String dest,
                                      byte[] data)
                               throws DataFormatException

  Send bytes through a SAM message-based session.

  Parameters:
    `dest` - Destination
    `data` - Bytes to be sent
  Returns:
    True if the data was sent, false otherwise
  Throws:
    `DataFormatException`

### sendBytesThroughMessageSession

    protected boolean sendBytesThroughMessageSession(String dest,
                                                     byte[] data)
                                              throws DataFormatException

  Actually send bytes through the SAM message-based session I2PSession (er...).

  Parameters:
    `dest` - Destination
    `data` - Bytes to be sent
  Returns:
    True if the data was sent, false otherwise
  Throws:
    `DataFormatException`

### close

    public void close()

  Close a SAM message-based session.

### messageReceived

    protected abstract void messageReceived(byte[] msg)

  Handle a new received message

  Parameters:
    `msg` - Message payload

### shutDown

    protected abstract void shutDown()

  Do whatever is needed to shutdown the SAM session

### getI2PSession

    protected I2PSession getI2PSession()

  Get the I2PSession object used by the SAM message-based session.

  Returns:
    The I2PSession of the SAM message-based session

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD