Mercurial > 510Connectbot
comparison src/ch/ethz/ssh2/LocalStreamForwarder.java @ 307:071eccdff8ea ganymed
fix java formatting
author | Carl Byington <carl@five-ten-sg.com> |
---|---|
date | Wed, 30 Jul 2014 14:16:58 -0700 |
parents | 91a31873c42a |
children |
comparison
equal
deleted
inserted
replaced
305:d2b303406d63 | 307:071eccdff8ea |
---|---|
18 * to the remote SSH-2 server). | 18 * to the remote SSH-2 server). |
19 * | 19 * |
20 * @author Christian Plattner | 20 * @author Christian Plattner |
21 * @version 2.50, 03/15/10 | 21 * @version 2.50, 03/15/10 |
22 */ | 22 */ |
23 public class LocalStreamForwarder | 23 public class LocalStreamForwarder { |
24 { | 24 private ChannelManager cm; |
25 private ChannelManager cm; | |
26 | 25 |
27 private Channel cn; | 26 private Channel cn; |
28 | 27 |
29 LocalStreamForwarder(ChannelManager cm, String host_to_connect, int port_to_connect) throws IOException | 28 LocalStreamForwarder(ChannelManager cm, String host_to_connect, int port_to_connect) throws IOException { |
30 { | 29 this.cm = cm; |
31 this.cm = cm; | 30 cn = cm.openDirectTCPIPChannel(host_to_connect, port_to_connect, |
32 cn = cm.openDirectTCPIPChannel(host_to_connect, port_to_connect, | 31 InetAddress.getLocalHost().getHostAddress(), 0); |
33 InetAddress.getLocalHost().getHostAddress(), 0); | 32 } |
34 } | |
35 | 33 |
36 /** | 34 /** |
37 * @return An <code>InputStream</code> object. | 35 * @return An <code>InputStream</code> object. |
38 * @throws IOException | 36 * @throws IOException |
39 */ | 37 */ |
40 public InputStream getInputStream() throws IOException | 38 public InputStream getInputStream() throws IOException { |
41 { | 39 return cn.getStdoutStream(); |
42 return cn.getStdoutStream(); | 40 } |
43 } | |
44 | 41 |
45 /** | 42 /** |
46 * Get the OutputStream. Please be aware that the implementation MAY use an | 43 * Get the OutputStream. Please be aware that the implementation MAY use an |
47 * internal buffer. To make sure that the buffered data is sent over the | 44 * internal buffer. To make sure that the buffered data is sent over the |
48 * tunnel, you have to call the <code>flush</code> method of the | 45 * tunnel, you have to call the <code>flush</code> method of the |
49 * <code>OutputStream</code>. To signal EOF, please use the | 46 * <code>OutputStream</code>. To signal EOF, please use the |
50 * <code>close</code> method of the <code>OutputStream</code>. | 47 * <code>close</code> method of the <code>OutputStream</code>. |
51 * | 48 * |
52 * @return An <code>OutputStream</code> object. | 49 * @return An <code>OutputStream</code> object. |
53 * @throws IOException | 50 * @throws IOException |
54 */ | 51 */ |
55 public OutputStream getOutputStream() throws IOException | 52 public OutputStream getOutputStream() throws IOException { |
56 { | 53 return cn.getStdinStream(); |
57 return cn.getStdinStream(); | 54 } |
58 } | |
59 | 55 |
60 /** | 56 /** |
61 * Close the underlying SSH forwarding channel and free up resources. | 57 * Close the underlying SSH forwarding channel and free up resources. |
62 * You can also use this method to force the shutdown of the underlying | 58 * You can also use this method to force the shutdown of the underlying |
63 * forwarding channel. Pending output (OutputStream not flushed) will NOT | 59 * forwarding channel. Pending output (OutputStream not flushed) will NOT |
64 * be sent. Pending input (InputStream) can still be read. If the shutdown | 60 * be sent. Pending input (InputStream) can still be read. If the shutdown |
65 * operation is already in progress (initiated from either side), then this | 61 * operation is already in progress (initiated from either side), then this |
66 * call is a no-op. | 62 * call is a no-op. |
67 * | 63 * |
68 * @throws IOException | 64 * @throws IOException |
69 */ | 65 */ |
70 public void close() throws IOException | 66 public void close() throws IOException { |
71 { | 67 cm.closeChannel(cn, "Closed due to user request.", true); |
72 cm.closeChannel(cn, "Closed due to user request.", true); | 68 } |
73 } | |
74 } | 69 } |