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 SAMDatagramSession

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

Direct Known Subclasses:
  SAMv3DatagramSession

    public class SAMDatagramSession

extends SAMMessageSession

SAM DATAGRAM session class.

Author:
  human

Nested Class Summary

Nested classes/interfaces inherited from class net.i2p.sam.SAMMessageSession
`SAMMessageSession.SAMMessageSessionHandler`

Field Summary
`static int` | `DGRAM_SIZE_MAX`
`protected SAMDatagramReceiver` | `recv`

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

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

Methods inherited from class net.i2p.sam.SAMMessageSession
`close, getDestination, getI2PSession, sendBytesThroughMessageSession`

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

Field Detail

### DGRAM_SIZE_MAX

    public static int DGRAM_SIZE_MAX

### recv

    protected SAMDatagramReceiver recv

Constructor Detail

### SAMDatagramSession

    public SAMDatagramSession(String dest,
                              Properties props,
                              SAMDatagramReceiver recv)
                       throws IOException,
                              DataFormatException,
                              I2PSessionException

  Create a new SAM DATAGRAM session.

  Parameters:
    `dest` - Base64-encoded destination (private key)
    `props` - Properties to setup the I2P session
    `recv` - Object that will receive incoming data
  Throws:
    `IOException`
    `DataFormatException`
    `I2PSessionException`

### SAMDatagramSession

    public SAMDatagramSession(InputStream destStream,
                              Properties props,
                              SAMDatagramReceiver recv)
                       throws IOException,
                              DataFormatException,
                              I2PSessionException

  Create a new SAM DATAGRAM session.

  Parameters:
    `destStream` - Input stream containing the destination keys
    `props` - Properties to setup the I2P session
    `recv` - Object that will receive incoming data
  Throws:
    `IOException`
    `DataFormatException`
    `I2PSessionException`

Method Detail

### sendBytes

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

  Send bytes through a SAM DATAGRAM session.

  Specified by:
    `sendBytes` in class `SAMMessageSession`
  Parameters:
    `dest` - Destination
    `data` - Bytes to be sent
  Returns:
    True if the data was sent, false otherwise
  Throws:
    `DataFormatException`

### messageReceived

    protected void messageReceived(byte[] msg)

  Description copied from class: `SAMMessageSession`
  Handle a new received message

  Specified by:
    `messageReceived` in class `SAMMessageSession`
  Parameters:
    `msg` - Message payload

### shutDown

    protected void shutDown()

  Description copied from class: `SAMMessageSession`
  Do whatever is needed to shutdown the SAM session

  Specified by:
    `shutDown` in class `SAMMessageSession`

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