net.i2p.client.streaming.impl
Class StandardSocket

java.lang.Object
  extended by java.net.Socket
      extended by net.i2p.client.streaming.impl.StandardSocket

 class StandardSocket
extends Socket

Bridge to I2PSocket. This extends Socket to make porting apps easier. Methods throw IOExceptions like Sockets do, rather than returning null for some methods. StandardSockets are always bound, and always start out connected (unless connectDelay is > 0). You may not create an unbound StandardSocket. Create this through the SocketManager. Todo: Make public and add getPeerDestination() ?

Since:
0.8.4
Author:
zzz

Constructor Summary
StandardSocket(I2PSocket socket)
           
 
Method Summary
 void bind(SocketAddress bindpoint)
           
 void close()
           
 void connect(SocketAddress endpoint)
           
 void connect(SocketAddress endpoint, int timeout)
           
 SocketChannel getChannel()
           
 InetAddress getInetAddress()
           
 InputStream getInputStream()
           
 boolean getKeepAlive()
           
 InetAddress getLocalAddress()
           
 int getLocalPort()
           
 SocketAddress getLocalSocketAddress()
           
 boolean getOOBInline()
           
 OutputStream getOutputStream()
           
 int getPort()
           
 int getReceiveBufferSize()
           
 SocketAddress getRemoteSocketAddress()
           
 boolean getReuseAddress()
           
 int getSendBufferSize()
           
 int getSoLinger()
           
 int getSoTimeout()
           
 boolean getTcpNoDelay()
           
 int getTrafficClass()
           
 boolean isBound()
           
 boolean isClosed()
           
 boolean isConnected()
           
 boolean isInputShutdown()
           
 boolean isOutputShutdown()
           
 void sendUrgentData(int data)
           
 void setKeepAlive(boolean on)
           
 void setOOBInline(boolean on)
           
 void setPerformancePreferences(int connectionTime, int latency, int bandwidth)
          Does nothing.
 void setReceiveBufferSize(int size)
          Does nothing.
 void setReuseAddress(boolean on)
          Does nothing.
 void setSendBufferSize(int size)
          Does nothing.
 void setSoLinger(boolean on, int linger)
          Does nothing.
 void setSoTimeout(int timeout)
           
 void setTcpNoDelay(boolean on)
          Does nothing.
 void setTrafficClass(int tc)
          Does nothing.
 void shutdownInput()
           
 void shutdownOutput()
           
 String toString()
           
 
Methods inherited from class java.net.Socket
setSocketImplFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

StandardSocket

StandardSocket(I2PSocket socket)
Method Detail

bind

public void bind(SocketAddress bindpoint)
Overrides:
bind in class Socket
Throws:
UnsupportedOperationException - always

close

public void close()
           throws IOException
Overrides:
close in class Socket
Throws:
IOException

connect

public void connect(SocketAddress endpoint)
Overrides:
connect in class Socket
Throws:
UnsupportedOperationException - always

connect

public void connect(SocketAddress endpoint,
                    int timeout)
Overrides:
connect in class Socket
Throws:
UnsupportedOperationException - always

getChannel

public SocketChannel getChannel()
Overrides:
getChannel in class Socket
Returns:
null always, unimplemented

getInetAddress

public InetAddress getInetAddress()
Overrides:
getInetAddress in class Socket
Returns:
null always

getInputStream

public InputStream getInputStream()
                           throws IOException
Overrides:
getInputStream in class Socket
Throws:
IOException

getKeepAlive

public boolean getKeepAlive()
Overrides:
getKeepAlive in class Socket

getLocalAddress

public InetAddress getLocalAddress()
Overrides:
getLocalAddress in class Socket
Returns:
null always

getLocalPort

public int getLocalPort()
Overrides:
getLocalPort in class Socket
Returns:
the port or 0 if unknown

getLocalSocketAddress

public SocketAddress getLocalSocketAddress()
Overrides:
getLocalSocketAddress in class Socket
Returns:
null always

getOOBInline

public boolean getOOBInline()
Overrides:
getOOBInline in class Socket
Returns:
false always

getOutputStream

public OutputStream getOutputStream()
                             throws IOException
Overrides:
getOutputStream in class Socket
Throws:
IOException

getPort

public int getPort()
Overrides:
getPort in class Socket
Returns:
the port or 0 if unknown

getReceiveBufferSize

public int getReceiveBufferSize()
Overrides:
getReceiveBufferSize in class Socket

getRemoteSocketAddress

public SocketAddress getRemoteSocketAddress()
Overrides:
getRemoteSocketAddress in class Socket
Throws:
UnsupportedOperationException - always

getReuseAddress

public boolean getReuseAddress()
Overrides:
getReuseAddress in class Socket
Returns:
false always

getSendBufferSize

public int getSendBufferSize()
Overrides:
getSendBufferSize in class Socket

getSoLinger

public int getSoLinger()
Overrides:
getSoLinger in class Socket

getSoTimeout

public int getSoTimeout()
Overrides:
getSoTimeout in class Socket

getTcpNoDelay

public boolean getTcpNoDelay()
Overrides:
getTcpNoDelay in class Socket
Returns:
false always

getTrafficClass

public int getTrafficClass()
Overrides:
getTrafficClass in class Socket
Returns:
0 always

isBound

public boolean isBound()
Overrides:
isBound in class Socket
Returns:
true always

isClosed

public boolean isClosed()
Overrides:
isClosed in class Socket

isConnected

public boolean isConnected()
Overrides:
isConnected in class Socket

isInputShutdown

public boolean isInputShutdown()
Overrides:
isInputShutdown in class Socket

isOutputShutdown

public boolean isOutputShutdown()
Overrides:
isOutputShutdown in class Socket

sendUrgentData

public void sendUrgentData(int data)
Overrides:
sendUrgentData in class Socket
Throws:
UnsupportedOperationException - always

setKeepAlive

public void setKeepAlive(boolean on)
Overrides:
setKeepAlive in class Socket

setOOBInline

public void setOOBInline(boolean on)
Overrides:
setOOBInline in class Socket
Throws:
UnsupportedOperationException - if on is true

setPerformancePreferences

public void setPerformancePreferences(int connectionTime,
                                      int latency,
                                      int bandwidth)
Does nothing.

Overrides:
setPerformancePreferences in class Socket

setReceiveBufferSize

public void setReceiveBufferSize(int size)
Does nothing.

Overrides:
setReceiveBufferSize in class Socket

setReuseAddress

public void setReuseAddress(boolean on)
Does nothing.

Overrides:
setReuseAddress in class Socket

setSendBufferSize

public void setSendBufferSize(int size)
Does nothing.

Overrides:
setSendBufferSize in class Socket

setSoLinger

public void setSoLinger(boolean on,
                        int linger)
Does nothing.

Overrides:
setSoLinger in class Socket

setSoTimeout

public void setSoTimeout(int timeout)
                  throws SocketException
Overrides:
setSoTimeout in class Socket
Throws:
SocketException

setTcpNoDelay

public void setTcpNoDelay(boolean on)
Does nothing.

Overrides:
setTcpNoDelay in class Socket

setTrafficClass

public void setTrafficClass(int tc)
Does nothing.

Overrides:
setTrafficClass in class Socket

shutdownInput

public void shutdownInput()
                   throws IOException
Overrides:
shutdownInput in class Socket
Throws:
IOException

shutdownOutput

public void shutdownOutput()
                    throws IOException
Overrides:
shutdownOutput in class Socket
Throws:
IOException

toString

public String toString()
Overrides:
toString in class Socket