public class ShellController extends java.lang.Object implements ShellReader, ShellWriter
| Modifier and Type | Field and Description |
|---|---|
protected java.io.InputStream |
in |
protected ShellMatcher |
matcher |
protected int |
readlimit |
protected ExpectShell |
shell |
| Modifier and Type | Method and Description |
|---|---|
void |
carriageReturn()
Send a carriage return to the remote command.
|
boolean |
expect(java.lang.String pattern)
Consume the output of the command until the pattern matches.
|
boolean |
expect(java.lang.String pattern,
boolean consumeRemainingLine)
Consume the output of the command until the pattern matches.
|
boolean |
expect(java.lang.String pattern,
boolean consumeRemainingLine,
long timeout)
Consume the output of the command until the pattern matches.
|
boolean |
expect(java.lang.String pattern,
boolean consumeRemainingLine,
long timeout,
long maxLines)
Consume the output of the command until the pattern matches.
|
boolean |
expect(java.lang.String pattern,
long timeout)
Consume the output of the command until the pattern matches.
|
boolean |
expectNextLine(java.lang.String pattern)
Perform expect on the next line of output only
|
boolean |
expectNextLine(java.lang.String pattern,
boolean consumeRemainingLine)
Perform expect on the next line of output only
|
boolean |
expectNextLine(java.lang.String pattern,
boolean consumeRemainingLine,
long timeout)
Perform expect on the next line of output only
|
int |
getReadlimit() |
void |
interrupt()
Interrupt the process by sending a Ctrl+C to the process.
|
boolean |
isActive() |
java.lang.String |
readLine()
Read a line of output from the process.
|
java.lang.String |
readLine(long timeout)
Read a line of output from the process.
|
void |
setMatcher(ShellMatcher matcher) |
void |
setReadlimit(int readlimit) |
void |
type(java.lang.String string)
Send data to the remote command just like the user had typed it.
|
void |
typeAndReturn(java.lang.String string)
Send data to the remote command and finish with a carriage return.
|
protected ExpectShell shell
protected ShellMatcher matcher
protected int readlimit
protected java.io.InputStream in
public void setMatcher(ShellMatcher matcher)
public void interrupt()
throws java.io.IOException
ShellWriterinterrupt in interface ShellWriterjava.io.IOExceptionpublic void type(java.lang.String string)
throws java.io.IOException
ShellWritertype in interface ShellWriterstring - the typed key datajava.io.IOExceptionpublic void carriageReturn()
throws java.io.IOException
ShellWritercarriageReturn in interface ShellWriterjava.io.IOExceptionpublic void typeAndReturn(java.lang.String string)
throws java.io.IOException
ShellWritertypeAndReturn in interface ShellWriterstring - Stringjava.io.IOExceptionpublic boolean expect(java.lang.String pattern)
throws ShellTimeoutException,
SshException
pattern - ShellTimeoutExceptionSshExceptionpublic boolean expect(java.lang.String pattern,
boolean consumeRemainingLine)
throws ShellTimeoutException,
SshException
pattern - consumeRemainingLine - ShellTimeoutExceptionSshExceptionpublic boolean expect(java.lang.String pattern,
long timeout)
throws ShellTimeoutException,
SshException
pattern - timeout - ShellTimeoutExceptionSshExceptionpublic boolean expect(java.lang.String pattern,
boolean consumeRemainingLine,
long timeout)
throws ShellTimeoutException,
SshException
pattern - consumeRemainingLine - timeout - maxLines - ShellTimeoutExceptionSshExceptionpublic boolean expectNextLine(java.lang.String pattern)
throws ShellTimeoutException,
SshException
pattern - ShellTimeoutExceptionSshExceptionpublic boolean expectNextLine(java.lang.String pattern,
boolean consumeRemainingLine)
throws ShellTimeoutException,
SshException
pattern - consumeRemainingLine - ShellTimeoutExceptionSshExceptionpublic boolean expectNextLine(java.lang.String pattern,
boolean consumeRemainingLine,
long timeout)
throws ShellTimeoutException,
SshException
pattern - consumeRemainingLine - timeout - ShellTimeoutExceptionSshExceptionpublic boolean expect(java.lang.String pattern,
boolean consumeRemainingLine,
long timeout,
long maxLines)
throws ShellTimeoutException,
SshException
pattern - consumeRemainingLine - timeout - maxLines - ShellTimeoutExceptionSshExceptionpublic boolean isActive()
public java.lang.String readLine()
throws SshException,
ShellTimeoutException
ShellReaderreadLine in interface ShellReaderSshExceptionShellTimeoutExceptionpublic java.lang.String readLine(long timeout)
throws SshException,
ShellTimeoutException
ShellReaderreadLine in interface ShellReaderSshExceptionShellTimeoutExceptionpublic int getReadlimit()
public void setReadlimit(int readlimit)
Copyright © 2022. All rights reserved.