com.jcraft.jsch
Interface SocketFactory


public interface SocketFactory

A factory for (client) sockets. This works similar to SocketFactory, but with the ability to replace/wrap the Streams without having to subclass Socket (and it works with before JDK 1.4, too).

An application may pass an implementation of this interface to the Session to control the creation of outgoing Sockets for port forwardings (to other hosts/ports on the local side) or for the main connection to the remote host.

See Also:
ServerSocketFactory, Session.setSocketFactory(com.jcraft.jsch.SocketFactory), Session.setPortForwardingR(String, int, String, int, SocketFactory)

Method Summary
 Socket createSocket(String host, int port)
          Creates a Socket connected to a given host/port.
 InputStream getInputStream(Socket socket)
          Creates an InputStream for a Socket.
 OutputStream getOutputStream(Socket socket)
          Creates an OutputStream for a Socket.
 

Method Detail

createSocket

Socket createSocket(String host,
                    int port)
                    throws IOException,
                           UnknownHostException
Creates a Socket connected to a given host/port.

Parameters:
host - the destination host name.
port - the destination port number.
Throws:
IOException
UnknownHostException

getInputStream

InputStream getInputStream(Socket socket)
                           throws IOException
Creates an InputStream for a Socket. The canonical implementation would simply do return socket.getInputStream(), but advanced implementations may wrap the stream.

Parameters:
socket - a socket created with createSocket(java.lang.String, int).
Returns:
an InputStream reading from the socket.
Throws:
IOException

getOutputStream

OutputStream getOutputStream(Socket socket)
                             throws IOException
Creates an OutputStream for a Socket. The canonical implementation would simply do return socket.getOutputStream(), but advanced implementations may wrap the stream.

Parameters:
socket - a socket created with createSocket(java.lang.String, int).
Returns:
an OutputStream writing to the socket.
Throws:
IOException


This is an inofficial Javadoc created by PaĆ­lo Ebermann. Have a look at the official homepage.