public class ExpectBuffer
extends java.lang.Object
ExpectBuffer holds the content of stdout and sterr of
a process. ExpectHandlers can use the consume...
method to consome content.
The Expectobject uses the append methods to add
new content to the buffer.| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
NL |
| Constructor and Description |
|---|
ExpectBuffer() |
| Modifier and Type | Method and Description |
|---|---|
void |
append(char[] s,
int offset,
int len)
Add new content to the buffer
|
void |
append(java.lang.String s)
Add new content to the buffer
|
java.lang.String |
consume(java.lang.String s)
Search the first occurancy of
s is the buffer and consume
it (s is also consumed). |
java.lang.String |
consumeLine()
The consume the content of the buffer until the next linefeed.
|
java.lang.String |
consumeLine(java.lang.String prefix)
Search a line which contains with
prefix and consume it. |
int |
length()
get the length of the buffer
|
public void append(char[] s,
int offset,
int len)
s - char array with the contentoffset - offset in the char arraylen - len of the the contentpublic void append(java.lang.String s)
s - a string with the contentpublic int length()
public java.lang.String consume(java.lang.String s)
s is the buffer and consume
it (s is also consumed).
If the content of the buffer is "1234" a consume("2") will remove "12".s - the search stringpublic java.lang.String consumeLine(java.lang.String prefix)
prefix and consume it.
If the content of a buffer is "1\\n123\\m" a consumeLine("2") will consume
"1\\n122\\n".prefix - the prefixpublic java.lang.String consumeLine()