Interface Channel
-
- All Superinterfaces:
java.lang.AutoCloseable
,java.io.Closeable
,ErrorNotifiable
,SSHPacketHandler
- All Known Subinterfaces:
Channel.Direct
,Channel.Forwarded
,Session
,Session.Command
,Session.Shell
,Session.Subsystem
- All Known Implementing Classes:
AbstractChannel
,AbstractDirectChannel
,AbstractForwardedChannel
,DirectConnection
,DirectTCPIPChannel
,LocalPortForwarder.ForwardedChannel
,RemotePortForwarder.ForwardedTCPIPChannel
,SessionChannel
,X11Forwarder.X11Channel
public interface Channel extends java.io.Closeable, SSHPacketHandler, ErrorNotifiable
A channel is the basic medium for application-layer data on top of an SSH transport.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
Channel.Direct
Direct channels are those that are initiated by us.static interface
Channel.Forwarded
Forwarded channels are those that are initiated by the server.-
Nested classes/interfaces inherited from interface net.schmizz.sshj.common.ErrorNotifiable
ErrorNotifiable.Util
-
-
Method Summary
Modifier and Type Method Description void
close()
Close this channel.boolean
getAutoExpand()
int
getID()
java.io.InputStream
getInputStream()
int
getLocalMaxPacketSize()
long
getLocalWinSize()
LoggerFactory
getLoggerFactory()
Get the LoggerFactory associated with the SSH client.java.io.OutputStream
getOutputStream()
int
getRecipient()
java.nio.charset.Charset
getRemoteCharset()
int
getRemoteMaxPacketSize()
long
getRemoteWinSize()
java.lang.String
getType()
boolean
isEOF()
Returns whether EOF has been received.boolean
isOpen()
void
join()
void
join(long timeout, java.util.concurrent.TimeUnit unit)
void
setAutoExpand(boolean autoExpand)
Set whether local window should automatically expand when data is received, irrespective of whether data has been read from that stream.-
Methods inherited from interface net.schmizz.sshj.common.ErrorNotifiable
notifyError
-
Methods inherited from interface net.schmizz.sshj.common.SSHPacketHandler
handle
-
-
-
-
Method Detail
-
close
void close() throws TransportException, ConnectionException
Close this channel.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Throws:
TransportException
ConnectionException
-
getAutoExpand
boolean getAutoExpand()
- Returns:
- whether auto-expansion of local window is set.
- See Also:
setAutoExpand(boolean)
-
getID
int getID()
- Returns:
- the channel ID
-
getInputStream
java.io.InputStream getInputStream()
- Returns:
- the
InputStream
for this channel.
-
getLocalMaxPacketSize
int getLocalMaxPacketSize()
- Returns:
- the maximum packet size that we have specified.
-
getLocalWinSize
long getLocalWinSize()
- Returns:
- the current local window size.
-
getOutputStream
java.io.OutputStream getOutputStream()
- Returns:
- an
OutputStream
for this channel.
-
getRecipient
int getRecipient()
- Returns:
- the channel ID at the remote end.
-
getRemoteCharset
java.nio.charset.Charset getRemoteCharset()
- Returns:
- the character set used to communicate with the remote machine for certain strings (like paths).
-
getRemoteMaxPacketSize
int getRemoteMaxPacketSize()
- Returns:
- the maximum packet size as specified by the remote end.
-
getRemoteWinSize
long getRemoteWinSize()
- Returns:
- the current remote window size.
-
getType
java.lang.String getType()
- Returns:
- the channel type identifier.
-
isOpen
boolean isOpen()
- Returns:
- whether the channel is open.
-
setAutoExpand
void setAutoExpand(boolean autoExpand)
Set whether local window should automatically expand when data is received, irrespective of whether data has been read from that stream. This is useful e.g. when a remote command produces a lot of output that would fill the local window but you are not interested in reading from itsInputStream
.- Parameters:
autoExpand
- whether local windows should automatically expand
-
join
void join() throws ConnectionException
- Throws:
ConnectionException
-
join
void join(long timeout, java.util.concurrent.TimeUnit unit) throws ConnectionException
- Throws:
ConnectionException
-
isEOF
boolean isEOF()
Returns whether EOF has been received.
-
getLoggerFactory
LoggerFactory getLoggerFactory()
Get the LoggerFactory associated with the SSH client.
-
-