net.i2p.client.streaming
Class I2PSocketImpl

java.lang.Object
  extended by net.i2p.client.streaming.I2PSocketImpl
All Implemented Interfaces:
I2PSocket

Deprecated. use I2PSocketFull

 class I2PSocketImpl
extends java.lang.Object
implements I2PSocket

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
          Deprecated.  
static int PACKET_DELAY
          Deprecated.  
 
Constructor Summary
I2PSocketImpl(Destination peer, I2PSocketManagerImpl mgr, boolean outgoing, java.lang.String localID)
          Deprecated.  
 
Method Summary
 void close()
          Deprecated. Closes the socket if not closed yet (from the Application side).
(package private)  void errorOccurred()
          Deprecated.  
 long getBytesReceived()
          Deprecated.  
 long getBytesSent()
          Deprecated.  
 long getClosedOn()
          Deprecated.  
 long getCreatedOn()
          Deprecated.  
 java.io.InputStream getInputStream()
          Deprecated. Return an InputStream to read from the socket.
 java.lang.String getLocalID()
          Deprecated. Our half of the socket's unique ID
 I2PSocketOptions getOptions()
          Deprecated.  
 java.io.OutputStream getOutputStream()
          Deprecated. Return an OutputStream to write into the socket.
 Destination getPeerDestination()
          Deprecated. Return the destination of the peer.
 long getReadTimeout()
          Deprecated. How long we will wait blocked on a read() operation.
 java.lang.String getRemoteID()
          Deprecated. 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)
          Deprecated. 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)
          Deprecated. 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()
          Deprecated. Return the Destination of this side of the socket.
protected  void internalClose()
          Deprecated. Close the socket from the I2P side (by a close packet)
 boolean isClosed()
          Deprecated.  
 void queueData(byte[] data)
          Deprecated. The other side has given us some data, so inject it into our socket's inputStream
 void setOptions(I2PSocketOptions options)
          Deprecated. Configure the socket
 void setReadTimeout(long ms)
          Deprecated. Define how long we will wait blocked on a read() operation (-1 will make the socket wait forever).
 void setRemoteID(java.lang.String id)
          Deprecated. We've received the other side's half of the socket's unique ID
 void setSocketErrorListener(I2PSocket.SocketErrorListener lsnr)
          Deprecated.  
 java.lang.String toString()
          Deprecated.  
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_PACKET_SIZE

public static final int MAX_PACKET_SIZE
Deprecated. 
See Also:
Constant Field Values

PACKET_DELAY

public static final int PACKET_DELAY
Deprecated. 
See Also:
Constant Field Values
Constructor Detail

I2PSocketImpl

public I2PSocketImpl(Destination peer,
                     I2PSocketManagerImpl mgr,
                     boolean outgoing,
                     java.lang.String localID)
Deprecated. 
Parameters:
peer - who this socket is (or should be) connected to
mgr - how we talk to the network
outgoing - did we initiate the connection (true) or did we receive it (false)?
localID - what is our half of the socket ID?
Method Detail

getLocalID

public java.lang.String getLocalID()
Deprecated. 
Our half of the socket's unique ID


setRemoteID

public void setRemoteID(java.lang.String id)
Deprecated. 
We've received the other side's half of the socket's unique ID


getRemoteID

public java.lang.String getRemoteID(boolean wait)
Deprecated. 
Retrieve the other side's half of the socket's unique ID, or null if it isn't known yet

Parameters:
wait - if true, we should wait until we receive it from the peer, otherwise return what we know immediately (which may be null)

getRemoteID

public java.lang.String getRemoteID(boolean wait,
                                    long maxWait)
                             throws java.io.InterruptedIOException
Deprecated. 
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

Parameters:
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)
Throws:
java.io.InterruptedIOException - when the max waiting period has been exceeded

getRemoteID

public java.lang.String getRemoteID()
Deprecated. 
Retrieve the other side's half of the socket's unique ID, or null if it isn't known yet. This does not wait


queueData

public void queueData(byte[] data)
Deprecated. 
The other side has given us some data, so inject it into our socket's inputStream

Parameters:
data - the data to inject into our local inputStream

getThisDestination

public Destination getThisDestination()
Deprecated. 
Return the Destination of this side of the socket.

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

getPeerDestination

public Destination getPeerDestination()
Deprecated. 
Return the destination of the peer.

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

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Deprecated. 
Return an InputStream to read from the socket.

Specified by:
getInputStream in interface I2PSocket
Returns:
an InputStream to read from the socket.
Throws:
java.io.IOException - on failure

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Deprecated. 
Return an OutputStream to write into the socket.

Specified by:
getOutputStream in interface I2PSocket
Returns:
an OutputStream to write into the socket.
Throws:
java.io.IOException - on failure

close

public void close()
           throws java.io.IOException
Deprecated. 
Closes the socket if not closed yet (from the Application side).

Specified by:
close in interface I2PSocket
Throws:
java.io.IOException - on failure

isClosed

public boolean isClosed()
Deprecated. 
Specified by:
isClosed in interface I2PSocket

internalClose

protected void internalClose()
Deprecated. 
Close the socket from the I2P side (by a close packet)


setOptions

public void setOptions(I2PSocketOptions options)
Deprecated. 
Description copied from interface: I2PSocket
Configure the socket

Specified by:
setOptions in interface I2PSocket
Parameters:
options - I2PSocketOptions to set

getOptions

public I2PSocketOptions getOptions()
Deprecated. 
Specified by:
getOptions in interface I2PSocket
Returns:
socket's configuration

getReadTimeout

public long getReadTimeout()
Deprecated. 
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

setReadTimeout

public void setReadTimeout(long ms)
Deprecated. 
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. 
Specified by:
setSocketErrorListener in interface I2PSocket

errorOccurred

void errorOccurred()
Deprecated. 

getBytesSent

public long getBytesSent()
Deprecated. 

getBytesReceived

public long getBytesReceived()
Deprecated. 

getCreatedOn

public long getCreatedOn()
Deprecated. 

getClosedOn

public long getClosedOn()
Deprecated. 

toString

public java.lang.String toString()
Deprecated. 
Overrides:
toString in class java.lang.Object