|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectexpectj.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 authenticate
public 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
SpawnableSpawn. It starts the
StreamPipers that enable copying of process stream contents to
standard streams.
start in interface SpawnableIOException - on trouble.public InputStream getStdout()
SpawnableSpawn's stdout can be read.
getStdout in interface SpawnableProcess.getInputStream()public OutputStream getStdin()
SpawnableSpawn's stdin can be written to.
getStdin in interface SpawnableProcess.getOutputStream()public InputStream getStderr()
SpawnableSpawn's stderr can be read.
getStderr in interface SpawnableProcess.getErrorStream()public boolean isClosed()
SpawnableSpawn has finished.
isClosed in interface Spawnablepublic int getExitValue()
SpawnableSpawn has exited, its exit code is returned.
getExitValue in interface SpawnableSpawnable.isClosed(),
System.exit(int)public void stop()
SpawnableSpawn. 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 | ||||||||