public class ShellController extends Object implements ShellReader, ShellWriter
| Modifier and Type | Field and Description |
|---|---|
protected InputStream |
in |
protected ShellMatcher |
matcher |
protected int |
readlimit |
protected Shell |
shell |
| Modifier and Type | Method and Description |
|---|---|
void |
carriageReturn()
Send a carriage return to the remote command.
|
boolean |
expect(String pattern)
Consume the output of the command until the pattern matches.
|
boolean |
expect(String pattern,
boolean consumeRemainingLine)
Consume the output of the command until the pattern matches.
|
boolean |
expect(String pattern,
boolean consumeRemainingLine,
long timeout)
Consume the output of the command until the pattern matches.
|
boolean |
expect(String pattern,
boolean consumeRemainingLine,
long timeout,
long maxLines)
Consume the output of the command until the pattern matches.
|
boolean |
expect(String pattern,
long timeout)
Consume the output of the command until the pattern matches.
|
boolean |
expectNextLine(String pattern)
Perform expect on the next line of output only
|
boolean |
expectNextLine(String pattern,
boolean consumeRemainingLine)
Perform expect on the next line of output only
|
boolean |
expectNextLine(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() |
String |
readLine()
Read a line of output from the process.
|
String |
readLine(long timeout)
Read a line of output from the process.
|
void |
setMatcher(ShellMatcher matcher) |
void |
setReadlimit(int readlimit) |
void |
type(String string)
Send data to the remote command just like the user had typed it.
|
void |
typeAndReturn(String string)
Send data to the remote command and finish with a carriage return.
|
protected Shell shell
protected ShellMatcher matcher
protected int readlimit
protected InputStream in
public void setMatcher(ShellMatcher matcher)
public void interrupt()
throws IOException
ShellWriterinterrupt in interface ShellWriterIOExceptionpublic void type(String string) throws IOException
ShellWritertype in interface ShellWriterstring - the typed key dataIOExceptionpublic void carriageReturn()
throws IOException
ShellWritercarriageReturn in interface ShellWriterIOExceptionpublic void typeAndReturn(String string) throws IOException
ShellWritertypeAndReturn in interface ShellWriterstring - StringIOExceptionpublic boolean expect(String pattern) throws ShellTimeoutException, SshException
pattern - ShellTimeoutExceptionSshExceptionpublic boolean expect(String pattern, boolean consumeRemainingLine) throws ShellTimeoutException, SshException
pattern - consumeRemainingLine - ShellTimeoutExceptionSshExceptionpublic boolean expect(String pattern, long timeout) throws ShellTimeoutException, SshException
pattern - timeout - ShellTimeoutExceptionSshExceptionpublic boolean expect(String pattern, boolean consumeRemainingLine, long timeout) throws ShellTimeoutException, SshException
pattern - consumeRemainingLine - timeout - maxLines - ShellTimeoutExceptionSshExceptionpublic boolean expectNextLine(String pattern) throws ShellTimeoutException, SshException
pattern - ShellTimeoutExceptionSshExceptionpublic boolean expectNextLine(String pattern, boolean consumeRemainingLine) throws ShellTimeoutException, SshException
pattern - consumeRemainingLine - ShellTimeoutExceptionSshExceptionpublic boolean expectNextLine(String pattern, boolean consumeRemainingLine, long timeout) throws ShellTimeoutException, SshException
pattern - consumeRemainingLine - timeout - ShellTimeoutExceptionSshExceptionpublic boolean expect(String pattern, boolean consumeRemainingLine, long timeout, long maxLines) throws ShellTimeoutException, SshException
pattern - consumeRemainingLine - timeout - maxLines - ShellTimeoutExceptionSshExceptionpublic boolean isActive()
public String readLine() throws SshException, ShellTimeoutException
ShellReaderreadLine in interface ShellReaderSshExceptionShellTimeoutExceptionpublic String readLine(long timeout) throws SshException, ShellTimeoutException
ShellReaderreadLine in interface ShellReaderSshExceptionShellTimeoutExceptionpublic int getReadlimit()
public void setReadlimit(int readlimit)
Copyright © 2025. All rights reserved.