net.i2p.client.streaming.impl

## Class I2PSocketFull

- java.lang.Object
- - net.i2p.client.streaming.impl.I2PSocketFull

- All Implemented Interfaces:
    Closeable, AutoCloseable, I2PSocket

      class I2PSocketFull
      extends Object
      implements I2PSocket

  Bridge between the full streaming lib and the I2PSocket API

- - ### Nested Class Summary

    - ### Nested classes/interfaces inherited from interface net.i2p.client.streaming.I2PSocket

      `I2PSocket.SocketErrorListener`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `I2PSocketFull(Connection con, I2PAppContext context)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Closes this socket.
    `(package private) void` | `destroy()`
    `(package private) void` | `destroy2()` Call from Connection.disconnectComplete() instead of destroy() so we don't loop
    `(package private) Connection` | `getConnection()`
    `InputStream` | `getInputStream()` As of 0.9.9 will throw an IOE if socket is closed.
    `int` | `getLocalPort()` The local port.
    `I2PSocketOptions` | `getOptions()`
    `OutputStream` | `getOutputStream()` As of 0.9.9 will throw an IOE if socket is closed.
    `Destination` | `getPeerDestination()`
    `int` | `getPort()` The remote port.
    `long` | `getReadTimeout()` How long we will wait blocked on a read() operation.
    `Destination` | `getThisDestination()`
    `boolean` | `isClosed()`
    `void` | `reset()` Resets and closes this socket.
    `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)` Deprecated, unimplemented, does nothing
    `String` | `toString()`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### I2PSocketFull

          public I2PSocketFull(Connection con,
                               I2PAppContext context)

  - ### Method Detail

    - #### close

          public void close()
                     throws IOException

      Closes this socket. Nonblocking as of 0.9.9: Any thread currently blocked in an I/O operation upon this socket will throw an IOException. Once a socket has been closed, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created. Closing this socket will also close the socket's InputStream and OutputStream.
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`
      Throws:
        `IOException`

    - #### destroy

          void destroy()

    - #### destroy2

          void destroy2()

      Call from Connection.disconnectComplete() instead of destroy() so we don't loop

    - #### getConnection

          Connection getConnection()

    - #### getInputStream

          public InputStream getInputStream()
                                     throws IOException

      As of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.
      Specified by:
        `getInputStream` in interface `I2PSocket`
      Returns:
        non-null
      Throws:
        `IOException` - on failure

    - #### getLocalPort

          public int getLocalPort()

      The local port.
      Specified by:
        `getLocalPort` in interface `I2PSocket`
      Returns:
        the port or 0 if unknown

    - #### getOptions

          public I2PSocketOptions getOptions()

      Specified by:
        `getOptions` in interface `I2PSocket`
      Returns:
        socket's configuration

    - #### getOutputStream

          public OutputStream getOutputStream()
                                       throws IOException

      As of 0.9.9 will throw an IOE if socket is closed. Prior to that would return null instead of throwing IOE.
      Specified by:
        `getOutputStream` in interface `I2PSocket`
      Returns:
        non-null
      Throws:
        `IOException` - on failure

    - #### getPeerDestination

          public Destination getPeerDestination()

      Specified by:
        `getPeerDestination` in interface `I2PSocket`
      Returns:
        the destination of the peer.

    - #### getPort

          public int getPort()

      The remote port.
      Specified by:
        `getPort` in interface `I2PSocket`
      Returns:
        the port or 0 if unknown

    - #### getReadTimeout

          public long getReadTimeout()

      Description copied from interface: `I2PSocket`
      How long we will wait blocked on a read() operation. This is simply a helper to query the I2PSocketOptions
      Specified by:
        `getReadTimeout` in interface `I2PSocket`
      Returns:
        milliseconds to wait, or -1 if we will wait indefinitely

    - #### getThisDestination

          public Destination getThisDestination()

      Specified by:
        `getThisDestination` in interface `I2PSocket`
      Returns:
        the Destination of this side of the socket.

    - #### isClosed

          public boolean isClosed()

      Specified by:
        `isClosed` in interface `I2PSocket`

    - #### reset

          public void reset()
                     throws IOException

      Resets and closes this socket. Sends a RESET indication to the far-end. This is the equivalent of setSoLinger(true, 0) followed by close() on a Java Socket. Nonblocking. Any thread currently blocked in an I/O operation upon this socket will throw an IOException. Once a socket has been reset, it is not available for further networking use (i.e. can't be reconnected or rebound). A new socket needs to be created. Resetting this socket will also close the socket's InputStream and OutputStream.
      Specified by:
        `reset` in interface `I2PSocket`
      Throws:
        `IOException`

    - #### setOptions

          public void setOptions(I2PSocketOptions options)

      Description copied from interface: `I2PSocket`
      Configure the socket
      Specified by:
        `setOptions` in interface `I2PSocket`
      Parameters:
        `options` - I2PSocketOptions to set

    - #### setReadTimeout

          public void setReadTimeout(long ms)

      Description copied from interface: `I2PSocket`
      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
      Specified by:
        `setReadTimeout` in interface `I2PSocket`
      Parameters:
        `ms` - timeout in ms

    - #### setSocketErrorListener

          public void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)

      Deprecated, unimplemented, does nothing
      Specified by:
        `setSocketErrorListener` in interface `I2PSocket`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`