|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.crsh.console.EditorBuffer
final class EditorBuffer
Field Summary | |
---|---|
private StringBuilder |
current . |
private int |
cursor Cursor position. |
private ConsoleDriver |
driver The output. |
private LinkedList<String> |
lines Previous lines. |
private boolean |
needFlush True if flush is needed. |
Constructor Summary | |
---|---|
EditorBuffer(ConsoleDriver driver) |
Method Summary | |
---|---|
EditorBuffer |
append(char c) |
EditorBuffer |
append(CharSequence s) |
EditorBuffer |
append(CharSequence csq, int start, int end) |
private void |
appendData(CharSequence s, int start, int end) |
private int |
appendDel() Delete the char before the cursor. |
(package private) char |
charAt(int index) Returns a character at a specified index in the buffer. |
(package private) int |
del() Delete the char under the cursor or return -1 if no char was deleted. |
private void |
echoCRLF() |
private void |
echoDel() |
(package private) void |
flush() |
(package private) void |
flush(boolean force) |
(package private) int |
getCursor() Returns the current cursor position. |
String |
getLine() |
List<String> |
getLines() |
(package private) int |
getSize() Returns the total number of chars in the buffer, independently of the cursor position. |
boolean |
hasNext() |
(package private) boolean |
moveLeft() |
(package private) int |
moveLeftBy(int count) |
(package private) boolean |
moveRight() |
(package private) boolean |
moveRight(char c) Move the cursor right by one char with the provided char. |
(package private) int |
moveRightBy(int count) |
private void |
newAppendNoLF(CharSequence s, int start, int end) |
String |
next() |
private int |
pop() Popup one char from buffer at the current cursor position. |
void |
remove() |
(package private) String |
replace(CharSequence s) Replace all the characters before the cursor by the provided char sequence. |
(package private) void |
reset() Reset the buffer state. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private StringBuilder current
private int cursor
private LinkedList<String> lines
private final ConsoleDriver driver
private boolean needFlush
Constructor Detail |
---|
EditorBuffer(ConsoleDriver driver)
Method Detail |
---|
void flush() throws IOException
IOException
void flush(boolean force) throws IOException
IOException
void reset()
int getSize()
int getCursor()
char charAt(int index) throws StringIndexOutOfBoundsException
index
- the indexStringIndexOutOfBoundsException
- if the index is negative or larget than the sizepublic String getLine()
public List<String> getLines()
public boolean hasNext()
hasNext
in interface Iterator<String>
public String next()
next
in interface Iterator<String>
public void remove()
remove
in interface Iterator<String>
public EditorBuffer append(char c) throws IOException
append
in interface Appendable
IOException
public EditorBuffer append(CharSequence s) throws IOException
append
in interface Appendable
IOException
public EditorBuffer append(CharSequence csq, int start, int end) throws IOException
append
in interface Appendable
IOException
String replace(CharSequence s) throws IOException
s
- the new char sequenceIOException
- any IOExceptionboolean moveRight(char c) throws IOException
c
- the char to overwriteIOException
boolean moveRight() throws IOException
IOException
boolean moveLeft() throws IOException
IOException
int moveRightBy(int count) throws IOException, IllegalArgumentException
IOException
IllegalArgumentException
int moveLeftBy(int count) throws IOException, IllegalArgumentException
IOException
IllegalArgumentException
int del() throws IOException
IOException
- any IOExceptionprivate void appendData(CharSequence s, int start, int end) throws IOException
IOException
private void newAppendNoLF(CharSequence s, int start, int end) throws IOException
IOException
private int appendDel() throws IOException
IOException
- any IOExceptionprivate void echoDel() throws IOException
IOException
private void echoCRLF() throws IOException
IOException
private int pop()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |