|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object expectj.AbstractSpawnable expectj.SshSpawn
public class SshSpawn
A Spawnable for controlling an SSH session using ExpectJ.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface expectj.Spawnable |
---|
Spawnable.CloseListener |
Constructor Summary | |
---|---|
SshSpawn(com.jcraft.jsch.Channel channel)
Takes control over an existing SSH channel. |
|
SshSpawn(String remoteHostName,
int remotePort,
String username,
String password)
Construct a new SSH spawn. |
Method Summary | |
---|---|
int |
getExitValue()
If the Spawn has exited, its exit code is returned. |
InputStream |
getStderr()
Get a stream from which the Spawn 's stderr can be read. |
OutputStream |
getStdin()
Get a stream through which the Spawn 's stdin can be written to. |
InputStream |
getStdout()
Get a stream from which the Spawn 's stdout can be read. |
boolean |
isClosed()
Find out whether the Spawn has finished. |
void |
start()
This method launches the Spawn . |
void |
stop()
Stops a running Spawn . |
Methods inherited from class expectj.AbstractSpawnable |
---|
onClose, setCloseListener |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface expectj.Spawnable |
---|
setCloseListener |
Constructor Detail |
---|
public SshSpawn(String remoteHostName, int remotePort, String username, String password)
remoteHostName
- The remote host to connect to.remotePort
- The remote port to connect to.username
- The user name with which to authenticatepassword
- The password with which to authenticatepublic SshSpawn(com.jcraft.jsch.Channel channel) throws IOException
channel
- The channel we should control. If this channel isn't
already connected, Channel.connect()
will be called.
IOException
- If connecting the channel fails.Method Detail |
---|
public void start() throws IOException
Spawnable
Spawn
. It starts the
StreamPiper
s that enable copying of process stream contents to
standard streams.
start
in interface Spawnable
IOException
- on trouble.public InputStream getStdout()
Spawnable
Spawn
's stdout can be read.
getStdout
in interface Spawnable
Process.getInputStream()
public OutputStream getStdin()
Spawnable
Spawn
's stdin can be written to.
getStdin
in interface Spawnable
Process.getOutputStream()
public InputStream getStderr()
Spawnable
Spawn
's stderr can be read.
getStderr
in interface Spawnable
Process.getErrorStream()
public boolean isClosed()
Spawnable
Spawn
has finished.
isClosed
in interface Spawnable
public int getExitValue()
Spawnable
Spawn
has exited, its exit code is returned.
getExitValue
in interface Spawnable
Spawnable.isClosed()
,
System.exit(int)
public void stop()
Spawnable
Spawn
. After this method returns,
Spawnable.isClosed()
must return true.
stop
in interface Spawnable
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |