final class EditorBuffer extends Object implements Appendable, Iterator<String>
| Modifier and Type | Field and Description |
|---|---|
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 and Description |
|---|
EditorBuffer(ConsoleDriver driver) |
| Modifier and Type | Method and Description |
|---|---|
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.
|
private StringBuilder current
private int cursor
private LinkedList<String> lines
private final ConsoleDriver driver
private boolean needFlush
EditorBuffer(ConsoleDriver driver)
void flush() throws IOException
IOExceptionvoid flush(boolean force) throws IOException
IOExceptionvoid reset()
int getSize()
int getCursor()
char charAt(int index) throws StringIndexOutOfBoundsException
index - the indexStringIndexOutOfBoundsException - if the index is negative or larget than the sizepublic EditorBuffer append(char c) throws IOException
append in interface AppendableIOExceptionpublic EditorBuffer append(CharSequence s) throws IOException
append in interface AppendableIOExceptionpublic EditorBuffer append(CharSequence csq, int start, int end) throws IOException
append in interface AppendableIOExceptionString replace(CharSequence s) throws IOException
s - the new char sequenceIOException - any IOExceptionboolean moveRight(char c) throws IOException
c - the char to overwriteIOExceptionboolean moveRight() throws IOException
IOExceptionboolean moveLeft() throws IOException
IOExceptionint moveRightBy(int count) throws IOException, IllegalArgumentException
IOExceptionIllegalArgumentExceptionint moveLeftBy(int count) throws IOException, IllegalArgumentException
IOExceptionIllegalArgumentExceptionint del() throws IOException
IOException - any IOExceptionprivate void appendData(CharSequence s, int start, int end) throws IOException
IOExceptionprivate void newAppendNoLF(CharSequence s, int start, int end) throws IOException
IOExceptionprivate int appendDel() throws IOException
IOException - any IOExceptionprivate void echoDel() throws IOException
IOExceptionprivate void echoCRLF() throws IOException
IOExceptionprivate int pop()
Copyright © 2015 eXo Platform SAS. All Rights Reserved.