Package org.apache.sshd.client.channel
Interface ClientChannel
-
- All Superinterfaces:
AttributeRepository
,AttributeStore
,java.lang.AutoCloseable
,java.nio.channels.Channel
,Channel
,ChannelListenerManager
,ChannelStreamPacketWriterResolver
,ChannelStreamPacketWriterResolverManager
,ClientSessionHolder
,java.io.Closeable
,Closeable
,PacketWriter
,PropertyResolver
,SessionContextHolder
,SessionHolder<Session>
- All Known Implementing Classes:
AbstractClientChannel
,AgentForwardedChannel
,ChannelDirectTcpip
,ChannelExec
,ChannelForwardedX11
,ChannelSession
,ChannelShell
,ChannelSubsystem
,PtyCapableChannelSession
,TcpipClientChannel
public interface ClientChannel extends Channel, ClientSessionHolder
A client channel used to communicate with the SSH server. Client channels can be shells, simple commands or subsystems. Note: client channels may be associated with a server session if they are opened by the server - e.g., for agent proxy, port forwarding, etc..
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
ClientChannel.Streaming
-
Nested classes/interfaces inherited from interface org.apache.sshd.common.AttributeRepository
AttributeRepository.AttributeKey<T>
-
-
Field Summary
-
Fields inherited from interface org.apache.sshd.common.channel.Channel
CHANNEL_EXEC, CHANNEL_SHELL, CHANNEL_SUBSYSTEM
-
Fields inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolver
NONE
-
Fields inherited from interface org.apache.sshd.common.Closeable
CLOSE_WAIT_TIMEOUT, DEFAULT_CLOSE_WAIT_TIMEOUT
-
Fields inherited from interface org.apache.sshd.common.PropertyResolver
EMPTY
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description IoInputStream
getAsyncErr()
IoOutputStream
getAsyncIn()
IoInputStream
getAsyncOut()
java.util.Set<ClientChannelEvent>
getChannelState()
java.lang.String
getChannelType()
default ClientSession
getClientSession()
java.lang.String
getExitSignal()
java.lang.Integer
getExitStatus()
java.io.InputStream
getInvertedErr()
java.io.OutputStream
getInvertedIn()
Access to an output stream to send data directly to the remote channel.java.io.InputStream
getInvertedOut()
ClientChannel.Streaming
getStreaming()
OpenFuture
open()
void
setErr(java.io.OutputStream err)
void
setIn(java.io.InputStream in)
Set an input stream that will be read by this channel and forwarded to the remote channel.void
setOut(java.io.OutputStream out)
void
setStreaming(ClientChannel.Streaming streaming)
static void
validateCommandExitStatusCode(java.lang.String command, java.lang.Integer exitStatus)
Makes sure remote command exit status has been provided and it is zerojava.util.Set<ClientChannelEvent>
waitFor(java.util.Collection<ClientChannelEvent> mask, long timeout)
Waits until any of the specified events in the mask is signaled-
Methods inherited from interface org.apache.sshd.common.AttributeRepository
attributeKeys, getAttribute, getAttributesCount
-
Methods inherited from interface org.apache.sshd.common.AttributeStore
clearAttributes, computeAttributeIfAbsent, removeAttribute, setAttribute
-
Methods inherited from interface org.apache.sshd.common.channel.Channel
addRequestHandler, addRequestHandlers, getId, getLocalWindow, getRecipient, getRemoteWindow, getRequestHandlers, handleClose, handleData, handleEof, handleExtendedData, handleFailure, handleOpenFailure, handleOpenSuccess, handleRequest, handleSuccess, handleWindowAdjust, init, isEofSignalled, isInitialized, open, removeRequestHandler, removeRequestHandlers, resolveAttribute
-
Methods inherited from interface org.apache.sshd.common.channel.ChannelListenerManager
addChannelListener, getChannelListenerProxy, removeChannelListener
-
Methods inherited from interface org.apache.sshd.common.channel.throttle.ChannelStreamPacketWriterResolverManager
getChannelStreamPacketWriterResolver, resolveChannelStreamPacketWriter, resolveChannelStreamPacketWriterResolver, setChannelStreamPacketWriterResolver
-
Methods inherited from interface org.apache.sshd.common.Closeable
addCloseFutureListener, close, close, isClosed, isClosing, isOpen, removeCloseFutureListener
-
Methods inherited from interface org.apache.sshd.common.io.PacketWriter
writePacket
-
Methods inherited from interface org.apache.sshd.common.PropertyResolver
getBoolean, getBooleanProperty, getCharset, getInteger, getIntProperty, getLong, getLongProperty, getObject, getParentPropertyResolver, getProperties, getString, getStringProperty
-
Methods inherited from interface org.apache.sshd.common.session.SessionHolder
getSession, getSessionContext
-
-
-
-
Method Detail
-
getClientSession
default ClientSession getClientSession()
- Specified by:
getClientSession
in interfaceClientSessionHolder
- Returns:
- The underlying
ClientSession
used
-
getChannelType
java.lang.String getChannelType()
- Returns:
- The type of channel reported when it was created
-
getStreaming
ClientChannel.Streaming getStreaming()
-
setStreaming
void setStreaming(ClientChannel.Streaming streaming)
-
getAsyncIn
IoOutputStream getAsyncIn()
-
getAsyncOut
IoInputStream getAsyncOut()
-
getAsyncErr
IoInputStream getAsyncErr()
-
getInvertedIn
java.io.OutputStream getInvertedIn()
Access to an output stream to send data directly to the remote channel. This can be used instead of usingsetIn(java.io.InputStream)
method and having the channel polling for data in that stream.- Returns:
- an OutputStream to be used to send data
-
getInvertedOut
java.io.InputStream getInvertedOut()
-
getInvertedErr
java.io.InputStream getInvertedErr()
-
setIn
void setIn(java.io.InputStream in)
Set an input stream that will be read by this channel and forwarded to the remote channel. Note that using such a stream will create an additional thread for pumping the stream which will only be able to end when that stream is actually closed or some data is read. It is recommended to use thegetInvertedIn()
method instead and write data directly.- Parameters:
in
- an InputStream to be polled and forwarded
-
setOut
void setOut(java.io.OutputStream out)
-
setErr
void setErr(java.io.OutputStream err)
-
open
OpenFuture open() throws java.io.IOException
- Throws:
java.io.IOException
-
getChannelState
java.util.Set<ClientChannelEvent> getChannelState()
- Returns:
- A snapshot of the current channel state
- See Also:
waitFor(Collection, long)
-
waitFor
java.util.Set<ClientChannelEvent> waitFor(java.util.Collection<ClientChannelEvent> mask, long timeout)
Waits until any of the specified events in the mask is signaled- Parameters:
mask
- TheClientChannelEvent
s masktimeout
- The timeout to wait (msec.) - if non-positive then forever- Returns:
- The actual signaled event - includes
ClientChannelEvent.TIMEOUT
if timeout expired before the expected event was signaled
-
getExitStatus
java.lang.Integer getExitStatus()
- Returns:
- The signaled exit status via "exit-status" request
-
null
if not signaled
-
getExitSignal
java.lang.String getExitSignal()
- Returns:
- The signaled exit signal via "exit-signal"
-
null
if not signaled
-
validateCommandExitStatusCode
static void validateCommandExitStatusCode(java.lang.String command, java.lang.Integer exitStatus) throws java.rmi.RemoteException
Makes sure remote command exit status has been provided and it is zero- Parameters:
command
- The command string - used only for exception textexitStatus
- The exit status value- Throws:
java.rmi.RemoteException
- If exitStatus isnull
or non-zero
-
-