class SocketWrapper extends Object implements I2PSocket
I2PSocket.SocketErrorListener
Constructor and Description |
---|
SocketWrapper(Socket sock) |
Modifier and Type | Method and Description |
---|---|
void |
close() |
SelectableChannel |
getChannel()
Deprecated.
|
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 |
setOptions(I2PSocketOptions options)
Does nothing
|
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
|
public SocketWrapper(Socket sock)
public Destination getThisDestination()
getThisDestination
in interface I2PSocket
public Destination getPeerDestination()
getPeerDestination
in interface I2PSocket
public InputStream getInputStream() throws IOException
I2PSocket
Note that operations on the returned stream may return an
IOException
whose cause as returned by
Throwable.getCause()
is an I2PSocketException
.
If so, the client may retrieve a status code via
I2PSocketException.getStatus()
to provide specific feedback to the user.
getInputStream
in interface I2PSocket
IOException
- on failurepublic OutputStream getOutputStream() throws IOException
I2PSocket
Note that operations on the returned stream may return an
IOException
whose cause as returned by
Throwable.getCause()
is an I2PSocketException
.
If so, the client may retrieve a status code via
I2PSocketException.getStatus()
to provide specific feedback to the user.
getOutputStream
in interface I2PSocket
IOException
- on failure@Deprecated public SelectableChannel getChannel()
I2PSocket
getChannel
in interface I2PSocket
public I2PSocketOptions getOptions()
getOptions
in interface I2PSocket
public void setOptions(I2PSocketOptions options)
setOptions
in interface I2PSocket
options
- I2PSocketOptions to setpublic long getReadTimeout()
I2PSocket
getReadTimeout
in interface I2PSocket
public void setReadTimeout(long ms)
I2PSocket
setReadTimeout
in interface I2PSocket
ms
- timeout in mspublic void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)
setSocketErrorListener
in interface I2PSocket
public int getPort()
public int getLocalPort()
getLocalPort
in interface I2PSocket