InvertedShell as a Command. This is useful when
using external processes. When starting the shell, this wrapper will also create a thread used to pump the streams
and also to check if the shell is alive.
| Modifier and Type | Field and Description |
|---|---|
| private int | |
| private ExitCallback | |
| private OutputStream | |
| private final Executor | |
| private InputStream | |
| private OutputStream | |
| private Duration | |
| private final InvertedShell | |
| private InputStream | |
| private OutputStream | |
| private InputStream | |
| private boolean |
| Access | Constructor and Description |
|---|---|
| public | InvertedShellWrapper(InvertedShell
The shell)InvertedShellAuto-allocates an |
| public | InvertedShellWrapper(InvertedShell
The shell, int InvertedShellBuffer size to use - must be above min. size ( bufferSize)Byte#SIZE)Auto-allocates an |
| public | InvertedShellWrapper(InvertedShell
The shell, Executor InvertedShellThe executor, boolean Executor to use in order to create the streams pump thread. If null
one is auto-allocated and shutdown when wrapper is destroy()-ed.If shutdownExecutor, int true the executor is shut down when shell wrapper is destroy()-ed.
Ignored if executor service auto-allocatedBuffer size to use - must be above min. size ( bufferSize)Byte#SIZE)
|
| Modifier and Type | Method and Description |
|---|---|
| public synchronized void | destroy(ChannelSession
The channel)ChannelSession through which the command has been receivedImplements org. This method is called by the SSH server to destroy the command because the client has disconnected somehow. |
| protected boolean | |
| protected void | |
| public void | setErrorStream(OutputStream
The err)OutputStream used by the shell to write its errorsImplements org. Set the error stream that can be used by the shell to write its errors. |
| public void | setExitCallback(ExitCallback
The callback)ExitCallback to call when shell is closedImplements org. Set the callback that the shell has to call when it is closed. |
| public void | setInputStream(InputStream
The in)InputStream used by the shell to read input.Implements org. Set the input stream that can be used by the shell to read input. |
| public void | setOutputStream(OutputStream
The out)OutputStream used by the shell to write its outputImplements org. Set the output stream that can be used by the shell to write its output. |
| public void | setSession(ServerSession
The session)ServerSession in which this shell will be executed.Implements org.
|
| public synchronized void | start(ChannelSession
The channel, Environment ChannelSession through which the command has been receivedThe env)EnvironmentImplements org. Starts the command execution. |
| public String |
| bufferSize | back to summary |
|---|---|
| private int bufferSize | |
| callback | back to summary |
|---|---|
| private ExitCallback callback | |
| err | back to summary |
|---|---|
| private OutputStream err | |
| executor | back to summary |
|---|---|
| private final Executor executor | |
| in | back to summary |
|---|---|
| private InputStream in | |
| out | back to summary |
|---|---|
| private OutputStream out | |
| pumpSleepTime | back to summary |
|---|---|
| private Duration pumpSleepTime | |
| shell | back to summary |
|---|---|
| private final InvertedShell shell | |
| shellErr | back to summary |
|---|---|
| private InputStream shellErr | |
| shellIn | back to summary |
|---|---|
| private OutputStream shellIn | |
| shellOut | back to summary |
|---|---|
| private InputStream shellOut | |
| shutdownExecutor | back to summary |
|---|---|
| private boolean shutdownExecutor | |
| InvertedShellWrapper | back to summary |
|---|---|
| public InvertedShellWrapper(InvertedShell shell) Auto-allocates an
| |
| InvertedShellWrapper | back to summary |
|---|---|
| public InvertedShellWrapper(InvertedShell shell, int bufferSize) Auto-allocates an
| |
| InvertedShellWrapper | back to summary |
|---|---|
public InvertedShellWrapper(InvertedShell shell, Executor executor, boolean shutdownExecutor, int bufferSize)
| |
| destroy | back to summary |
|---|---|
| public synchronized void destroy(ChannelSession channel) throws Exception Implements org. Doc from org. This method is called by the SSH server to destroy the command because the client has disconnected somehow.
| |
| pumpStream | back to summary |
|---|---|
| protected boolean pumpStream(InputStream in, OutputStream out, byte[] buffer) throws IOException | |
| pumpStreams | back to summary |
|---|---|
| protected void pumpStreams() | |
| setErrorStream | back to summary |
|---|---|
| public void setErrorStream(OutputStream err) Implements org. Doc from org. Set the error stream that can be used by the shell to write its errors.
| |
| setExitCallback | back to summary |
|---|---|
| public void setExitCallback(ExitCallback callback) Implements org. Doc from org. Set the callback that the shell has to call when it is closed.
| |
| setInputStream | back to summary |
|---|---|
| public void setInputStream(InputStream in) Implements org. Doc from org. Set the input stream that can be used by the shell to read input.
| |
| setOutputStream | back to summary |
|---|---|
| public void setOutputStream(OutputStream out) Implements org. Doc from org. Set the output stream that can be used by the shell to write its output.
| |
| setSession | back to summary |
|---|---|
| public void setSession(ServerSession session) Implements org.
| |
| start | back to summary |
|---|---|
| public synchronized void start(ChannelSession channel, Environment env) throws IOException Implements org. Doc from org. Starts the command execution. All streams must have been set before calling this method. The command
should implement
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |