public class LineBuffer extends Object
The class acts as a wrapper around a Terminal instance, and
makes sure that a list of lines can be updated and printed properly to
the terminal in the most efficient order.
Example uses are for showing a list of Progress'es, or
handling the internals of a InputSelection.
| Constructor and Description |
|---|
LineBuffer(Terminal terminal)
Create a LineBuffer instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
add(Collection<String> lines)
Add new lines to the end of the buffer, and print them out.
|
void |
add(String... lines)
Add new lines to the end of the buffer, and print them out.
|
void |
clear()
Clear the entire buffer, and the terminal area it represents.
|
void |
clearLast(int N)
Clear the last N lines, and move the cursor to the end of the last
remaining line.
|
int |
count() |
List<String> |
lines() |
void |
update(int offset,
List<String> lines)
Update a number of lines starting at a specific offset.
|
void |
update(int offset,
String... lines)
Update a number of lines starting at a specific offset.
|
public LineBuffer(Terminal terminal)
terminal - The terminal to wrap.public int count()
public void add(String... lines)
lines - The lines to add.public void add(Collection<String> lines)
lines - The lines to add.public void update(int offset,
String... lines)
offset - The line offset (0-indexed to count).lines - The new line content.public void update(int offset,
List<String> lines)
offset - The line offset (0-indexed to count).lines - The new line content.public void clear()
public void clearLast(int N)
N - Number of lines to clear.Copyright © 2017. All rights reserved.