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.client.streaming
Interface I2PSocket

All Known Implementing Classes:
  I2PSocketFull, I2PSocketImpl

    public interface I2PSocket

Minimalistic adapter between the socket api and I2PTunnel's way. Note that this interface is a "subinterface" of the interface defined in the "official" streaming api.

Nested Class Summary
`static interface` | `I2PSocket.SocketErrorListener` Allow notification of underlying errors communicating across I2P without waiting for any sort of cleanup process.

Method Summary
`void` | `close()` Closes the socket if not closed yet
`InputStream` | `getInputStream()`
`I2PSocketOptions` | `getOptions()`
`OutputStream` | `getOutputStream()`
`Destination` | `getPeerDestination()`
`long` | `getReadTimeout()` How long we will wait blocked on a read() operation.
`Destination` | `getThisDestination()`
`boolean` | `isClosed()`
`void` | `setOptions(I2PSocketOptions options)` Configure the socket
`void` | `setReadTimeout(long ms)` Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever).
`void` | `setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)`

Method Detail

### getThisDestination

    Destination getThisDestination()

  Returns:
    the Destination of this side of the socket.

### getPeerDestination

    Destination getPeerDestination()

  Returns:
    the destination of the peer.

### getInputStream

    InputStream getInputStream()
                               throws IOException

  Returns:
    an InputStream to read from the socket.
  Throws:
    `IOException` - on failure

### getOutputStream

    OutputStream getOutputStream()
                                 throws IOException

  Returns:
    an OutputStream to write into the socket.
  Throws:
    `IOException` - on failure

### getOptions

    I2PSocketOptions getOptions()

  Returns:
    socket's configuration

### setOptions

    void setOptions(I2PSocketOptions options)

  Configure the socket

  Parameters:
    `options` - I2PSocketOptions to set

### getReadTimeout

    long getReadTimeout()

  How long we will wait blocked on a read() operation. This is simply a helper to query the I2PSocketOptions

  Returns:
    milliseconds to wait, or -1 if we will wait indefinitely

### setReadTimeout

    void setReadTimeout(long ms)

  Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever). This is simply a helper to adjust the I2PSocketOptions

  Parameters:
    `ms` - timeout in ms

### close

    void close()
               throws IOException

  Closes the socket if not closed yet

  Throws:
    `IOException` - on failure

### isClosed

    boolean isClosed()

### setSocketErrorListener

    void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)

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