Package com.trilead.ssh2
Class LocalStreamForwarder
- java.lang.Object
-
- com.trilead.ssh2.LocalStreamForwarder
-
public class LocalStreamForwarder extends java.lang.Object
ALocalStreamForwarder
forwards an Input- and Outputstream pair via the secure tunnel to another host (which may or may not be identical to the remote SSH-2 server).- Version:
- $Id: LocalStreamForwarder.java,v 1.1 2007/10/15 12:49:56 cplattne Exp $
-
-
Field Summary
Fields Modifier and Type Field Description (package private) ChannelManager
cm
(package private) Channel
cn
(package private) java.lang.String
host_to_connect
(package private) LocalAcceptThread
lat
(package private) int
port_to_connect
-
Constructor Summary
Constructors Constructor Description LocalStreamForwarder(ChannelManager cm, java.lang.String host_to_connect, int port_to_connect)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close the underlying SSH forwarding channel and free up resources.java.io.InputStream
getInputStream()
java.io.OutputStream
getOutputStream()
Get the OutputStream.
-
-
-
Field Detail
-
cm
ChannelManager cm
-
host_to_connect
java.lang.String host_to_connect
-
port_to_connect
int port_to_connect
-
lat
LocalAcceptThread lat
-
cn
Channel cn
-
-
Constructor Detail
-
LocalStreamForwarder
LocalStreamForwarder(ChannelManager cm, java.lang.String host_to_connect, int port_to_connect) throws java.io.IOException
- Throws:
java.io.IOException
-
-
Method Detail
-
getInputStream
public java.io.InputStream getInputStream() throws java.io.IOException
- Returns:
- An
InputStream
object. - Throws:
java.io.IOException
- the io exception
-
getOutputStream
public java.io.OutputStream getOutputStream() throws java.io.IOException
Get the OutputStream. Please be aware that the implementation MAY use an internal buffer. To make sure that the buffered data is sent over the tunnel, you have to call theflush
method of theOutputStream
. To signal EOF, please use theclose
method of theOutputStream
.- Returns:
- An
OutputStream
object. - Throws:
java.io.IOException
- the io exception
-
close
public void close() throws java.io.IOException
Close the underlying SSH forwarding channel and free up resources. You can also use this method to force the shutdown of the underlying forwarding channel. Pending output (OutputStream not flushed) will NOT be sent. Pending input (InputStream) can still be read. If the shutdown operation is already in progress (initiated from either side), then this call is a no-op.- Throws:
java.io.IOException
- the io exception
-
-