|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crsh.term.console.Console
public final class Console
This class provides an abstraction for a console. This implementation wraps the input and output of a terminal based on a bidirectional io.
Interactions between terminal and console are done though the ViewReader
and ViewWriter
classes.
Field Summary | |
---|---|
private char[] |
buffer
. |
private int |
curAt
Cursor Position, always equal to size unless the underlying *.IO class supports editing. |
private boolean |
echoing
Whether or not we do echoing. |
private LinkedList<CharSequence> |
lines
. |
private boolean |
previousCR
Do we have a issued a CR previously? |
private ConsoleReader |
reader
. |
private int |
size
. |
private ViewReader |
viewReader
. |
private ViewWriter |
viewWriter
. |
private ConsoleWriter |
writer
. |
Constructor Summary | |
---|---|
Console(ViewWriter viewWriter)
|
Method Summary | |
---|---|
private boolean |
appendData(char c)
Append a char at the current cursor position and increment the cursor position. |
private boolean |
appendData(CharSequence s,
int start,
int end)
|
private int |
appendDel()
Delete the char before the cursor. |
void |
clearBuffer()
Clears the buffer without doing any echoing. |
private boolean |
echo(char c)
|
private void |
echo(String s)
|
private boolean |
echoCRLF()
|
private boolean |
echoDel()
|
CharSequence |
getBuffer()
|
CharSequence |
getBufferToCursor()
|
ConsoleReader |
getReader()
Returns the console reader. |
ViewReader |
getViewReader()
|
ConsoleWriter |
getWriter()
|
boolean |
isEchoing()
|
private boolean |
moveLeft()
|
private boolean |
moveRight()
|
private int |
pop()
Popup one char from buffer at the current cursor position. |
private boolean |
push(char c)
Push one char in the buffer at the current cursor position. |
void |
setEchoing(boolean echoing)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private char[] buffer
private int size
private int curAt
size
unless the underlying *.IO class supports editing.
private LinkedList<CharSequence> lines
private boolean previousCR
private boolean echoing
private final ViewWriter viewWriter
private final ViewReader viewReader
private final ConsoleReader reader
private final ConsoleWriter writer
Constructor Detail |
---|
public Console(ViewWriter viewWriter)
Method Detail |
---|
public void clearBuffer()
public CharSequence getBuffer()
public CharSequence getBufferToCursor()
public boolean isEchoing()
public void setEchoing(boolean echoing)
public ConsoleReader getReader()
public ViewReader getViewReader()
public ConsoleWriter getWriter()
private boolean appendData(CharSequence s, int start, int end) throws IOException
IOException
private boolean appendData(char c) throws IOException
c
- the char to append
IOException
- any IOExceptionprivate int appendDel() throws IOException
IOException
- any IOExceptionprivate boolean moveRight() throws IOException
IOException
private boolean moveLeft() throws IOException
IOException
private boolean echo(char c) throws IOException
IOException
private void echo(String s) throws IOException
IOException
private boolean echoDel() throws IOException
IOException
private boolean echoCRLF() throws IOException
IOException
private int pop()
private boolean push(char c)
c
- the char to push
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |