com.sshtools.net
Class SocketWrapper

java.lang.Object
  extended bycom.sshtools.net.SocketWrapper
All Implemented Interfaces:
SocketTimeoutSupport, SshIO, SshTransport
Direct Known Subclasses:
HttpProxyTransportWrapper

public class SocketWrapper
extends java.lang.Object
implements SshTransport, SocketTimeoutSupport

Implements a basic wrapper around a Socket to provide an SshTransport suitable for use in making connections using the SshConnector.

Author:
Lee David Painter

Field Summary
protected  java.net.Socket socket
           
 
Constructor Summary
SocketWrapper(java.net.Socket socket)
          Create a SocketWrapper
 
Method Summary
 void close()
          Close the channel.
 SshTransport duplicate()
          Create a new copy of this transport and connect to the same host:port combination.
 java.lang.String getHost()
          Get the name of the connected host.
 java.io.InputStream getInputStream()
          Get an InputStream to read incoming channel data.
 java.io.OutputStream getOutputStream()
          Get an OutputStream to write outgoing channel data.
 int getPort()
          Get the port of this connection
 int getSoTimeout()
          Get the current socket timeout in milliseconds.
 void setSoTimeout(int timeout)
          Set the socket timeout in milliseconds.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

socket

protected java.net.Socket socket
Constructor Detail

SocketWrapper

public SocketWrapper(java.net.Socket socket)
Create a SocketWrapper

Parameters:
socket -
Method Detail

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException
Description copied from interface: SshIO
Get an InputStream to read incoming channel data.

Specified by:
getInputStream in interface SshIO
Returns:
the channels InputStream
Throws:
java.io.IOException

getOutputStream

public java.io.OutputStream getOutputStream()
                                     throws java.io.IOException
Description copied from interface: SshIO
Get an OutputStream to write outgoing channel data.

Specified by:
getOutputStream in interface SshIO
Returns:
the channels OutputStream
Throws:
java.io.IOException

getHost

public java.lang.String getHost()
Description copied from interface: SshTransport
Get the name of the connected host.

Specified by:
getHost in interface SshTransport
Returns:
the name of the connected host

getPort

public int getPort()
Description copied from interface: SshTransport
Get the port of this connection

Specified by:
getPort in interface SshTransport
Returns:
int

close

public void close()
           throws java.io.IOException
Description copied from interface: SshIO
Close the channel.

Specified by:
close in interface SshIO
Throws:
java.io.IOException

duplicate

public SshTransport duplicate()
                       throws java.io.IOException
Description copied from interface: SshTransport
Create a new copy of this transport and connect to the same host:port combination. This is used by the SshClient to duplicate a client connection.

Specified by:
duplicate in interface SshTransport
Returns:
Throws:
java.io.IOException

setSoTimeout

public void setSoTimeout(int timeout)
                  throws java.io.IOException
Description copied from interface: SocketTimeoutSupport
Set the socket timeout in milliseconds.

Specified by:
setSoTimeout in interface SocketTimeoutSupport
Parameters:
timeout - int
Throws:
java.io.IOException

getSoTimeout

public int getSoTimeout()
                 throws java.io.IOException
Description copied from interface: SocketTimeoutSupport
Get the current socket timeout in milliseconds.

Specified by:
getSoTimeout in interface SocketTimeoutSupport
Returns:
int
Throws:
java.io.IOException


Copyright © 2003 3SP LTD. All Rights Reserved.