public class CommandRunner.ChannelExecWrapper
extends java.lang.Object
getXxxStream() for the streams you want to work with, which
will return an opened stream. Use the stream as needed then call
close() on the ChannelExecWrapper
itself, which will return the the exit code from the execution of the
command.| Modifier and Type | Field and Description |
|---|---|
protected com.jcraft.jsch.ChannelExec |
channel |
protected java.lang.String |
command |
protected java.io.OutputStream |
passedInStdErr |
protected java.io.InputStream |
passedInStdIn |
protected java.io.OutputStream |
passedInStdOut |
protected java.io.InputStream |
stdErr |
protected java.io.OutputStream |
stdIn |
protected java.io.InputStream |
stdOut |
| Modifier | Constructor and Description |
|---|---|
protected |
CommandRunner.ChannelExecWrapper() |
|
CommandRunner.ChannelExecWrapper(com.jcraft.jsch.Session session,
java.lang.String command,
java.io.InputStream stdIn,
java.io.OutputStream stdOut,
java.io.OutputStream stdErr) |
| Modifier and Type | Method and Description |
|---|---|
int |
close()
Safely closes all stream, waits for the underlying connection to
close, then returns the exit code from the command execution.
|
java.io.InputStream |
getErrStream()
Returns the STDERR stream for you to read from.
|
java.io.InputStream |
getInputStream()
Returns the STDOUT stream for you to read from.
|
java.io.OutputStream |
getOutputStream()
Returns the STDIN stream for you to write to.
|
protected com.jcraft.jsch.ChannelExec channel
protected java.lang.String command
protected java.io.OutputStream passedInStdErr
protected java.io.InputStream passedInStdIn
protected java.io.OutputStream passedInStdOut
protected java.io.InputStream stdErr
protected java.io.OutputStream stdIn
protected java.io.InputStream stdOut
protected CommandRunner.ChannelExecWrapper()
public CommandRunner.ChannelExecWrapper(com.jcraft.jsch.Session session,
java.lang.String command,
java.io.InputStream stdIn,
java.io.OutputStream stdOut,
java.io.OutputStream stdErr)
throws com.jcraft.jsch.JSchException,
java.io.IOException
com.jcraft.jsch.JSchExceptionjava.io.IOExceptionpublic int close()
public java.io.InputStream getErrStream()
throws java.io.IOException
close();java.io.IOException - If unable to read from the streampublic java.io.InputStream getInputStream()
throws java.io.IOException
close();java.io.IOException - If unable to read from the streampublic java.io.OutputStream getOutputStream()
throws java.io.IOException
close();java.io.IOException - If unable to write to the streamCopyright © 2018 pastdev.com. All Rights Reserved.