|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.i2p.client.streaming.I2PSocketImpl
class I2PSocketImpl
Initial stub implementation for the socket
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface net.i2p.client.streaming.I2PSocket |
---|
I2PSocket.SocketErrorListener |
Field Summary | |
---|---|
static int |
MAX_PACKET_SIZE
|
static int |
PACKET_DELAY
|
Constructor Summary | |
---|---|
I2PSocketImpl(Destination peer,
I2PSocketManagerImpl mgr,
boolean outgoing,
java.lang.String localID)
|
Method Summary | |
---|---|
void |
close()
Closes the socket if not closed yet (from the Application side). |
(package private) void |
errorOccurred()
|
long |
getBytesReceived()
|
long |
getBytesSent()
|
long |
getClosedOn()
|
long |
getCreatedOn()
|
java.io.InputStream |
getInputStream()
Return an InputStream to read from the socket. |
java.lang.String |
getLocalID()
Our half of the socket's unique ID |
I2PSocketOptions |
getOptions()
Retrieve this socket's configuration |
java.io.OutputStream |
getOutputStream()
Return an OutputStream to write into the socket. |
Destination |
getPeerDestination()
Return the destination of the peer. |
long |
getReadTimeout()
How long we will wait blocked on a read() operation. |
java.lang.String |
getRemoteID()
Retrieve the other side's half of the socket's unique ID, or null if it isn't known yet. |
java.lang.String |
getRemoteID(boolean wait)
Retrieve the other side's half of the socket's unique ID, or null if it isn't known yet |
java.lang.String |
getRemoteID(boolean wait,
long maxWait)
Retrieve the other side's half of the socket's unique ID, or null if it isn't known yet and we were instructed not to wait |
Destination |
getThisDestination()
Return the Destination of this side of the socket. |
protected void |
internalClose()
Close the socket from the I2P side (by a close packet) |
boolean |
isClosed()
|
void |
queueData(byte[] data)
The other side has given us some data, so inject it into our socket's inputStream |
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 |
setRemoteID(java.lang.String id)
We've received the other side's half of the socket's unique ID |
void |
setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)
|
java.lang.String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final int MAX_PACKET_SIZE
public static final int PACKET_DELAY
Constructor Detail |
---|
public I2PSocketImpl(Destination peer, I2PSocketManagerImpl mgr, boolean outgoing, java.lang.String localID)
peer
- who this socket is (or should be) connected tomgr
- how we talk to the networkoutgoing
- did we initiate the connection (true) or did we receive it (false)?localID
- what is our half of the socket ID?Method Detail |
---|
public java.lang.String getLocalID()
public void setRemoteID(java.lang.String id)
public java.lang.String getRemoteID(boolean wait)
wait
- if true, we should wait until we receive it from the peer, otherwise
return what we know immediately (which may be null)public java.lang.String getRemoteID(boolean wait, long maxWait) throws java.io.InterruptedIOException
wait
- should we wait for the peer to send us their half of the ID, or
just return immediately?maxWait
- if we're going to wait, after how long should we timeout and fail?
(if this value is < 0, we wait indefinitely)
java.io.InterruptedIOException
- when the max waiting period has been exceededpublic java.lang.String getRemoteID()
public void queueData(byte[] data)
data
- the data to inject into our local inputStreampublic Destination getThisDestination()
getThisDestination
in interface I2PSocket
public Destination getPeerDestination()
getPeerDestination
in interface I2PSocket
public java.io.InputStream getInputStream() throws java.io.IOException
getInputStream
in interface I2PSocket
java.io.IOException
public java.io.OutputStream getOutputStream() throws java.io.IOException
getOutputStream
in interface I2PSocket
java.io.IOException
public void close() throws java.io.IOException
close
in interface I2PSocket
java.io.IOException
public boolean isClosed()
isClosed
in interface I2PSocket
protected void internalClose()
public void setOptions(I2PSocketOptions options)
I2PSocket
setOptions
in interface I2PSocket
public I2PSocketOptions getOptions()
I2PSocket
getOptions
in interface I2PSocket
public long getReadTimeout()
getReadTimeout
in interface I2PSocket
public void setReadTimeout(long ms)
setReadTimeout
in interface I2PSocket
public void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)
setSocketErrorListener
in interface I2PSocket
void errorOccurred()
public long getBytesSent()
public long getBytesReceived()
public long getCreatedOn()
public long getClosedOn()
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |