public class InvertedShellWrapper extends Object implements Command, SessionAware
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 |
|---|---|
static int |
DEFAULT_BUFFER_SIZE
default buffer size for the IO pumps.
|
| Constructor and Description |
|---|
InvertedShellWrapper(InvertedShell shell) |
InvertedShellWrapper(InvertedShell shell,
Executor executor) |
InvertedShellWrapper(InvertedShell shell,
Executor executor,
boolean shutdownExecutor,
int bufferSize) |
InvertedShellWrapper(InvertedShell shell,
Executor executor,
int bufferSize) |
InvertedShellWrapper(InvertedShell shell,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Destroy the shell.
|
protected void |
pumpStreams() |
void |
setErrorStream(OutputStream err)
Set the error stream that can be used by the shell to write its errors.
|
void |
setExitCallback(ExitCallback callback)
Set the callback that the shell has to call when it is closed.
|
void |
setInputStream(InputStream in)
Set the input stream that can be used by the shell to read input.
|
void |
setOutputStream(OutputStream out)
Set the output stream that can be used by the shell to write its output.
|
void |
setSession(ServerSession session) |
void |
start(Environment env)
Starts the shell.
|
public static final int DEFAULT_BUFFER_SIZE
public InvertedShellWrapper(InvertedShell shell)
public InvertedShellWrapper(InvertedShell shell, Executor executor)
public InvertedShellWrapper(InvertedShell shell, int bufferSize)
public InvertedShellWrapper(InvertedShell shell, Executor executor, int bufferSize)
public InvertedShellWrapper(InvertedShell shell, Executor executor, boolean shutdownExecutor, int bufferSize)
public void setInputStream(InputStream in)
CommandsetInputStream in interface Commandin - The InputStream used by the shell to read input.public void setOutputStream(OutputStream out)
CommandsetOutputStream in interface Commandout - The OutputStream used by the shell to write its outputpublic void setErrorStream(OutputStream err)
CommandsetErrorStream in interface Commanderr - The OutputStream used by the shell to write its errorspublic void setExitCallback(ExitCallback callback)
CommandsetExitCallback in interface Commandcallback - The ExitCallback to call when shell is closedpublic void setSession(ServerSession session)
setSession in interface SessionAwaresession - The ServerSession in which this shell will be executed.public void start(Environment env) throws IOException
Command
Thread(this).start();
start in interface Commandenv - The EnvironmentIOException - If failed to startpublic void destroy()
Commandprotected void pumpStreams()
Copyright © 2008–2015 The Apache Software Foundation. All rights reserved.