public interface History extends Iterable<History.Entry>
Modifier and Type | Interface and Description |
---|---|
static interface |
History.Entry |
Modifier and Type | Method and Description |
---|---|
void |
add(Instant time,
String line) |
default void |
add(String line) |
void |
append(Path file,
boolean incremental)
Append history to the file.
|
void |
attach(LineReader reader)
Initialize the history for the given reader.
|
String |
current()
Return the content of the current buffer.
|
int |
first() |
String |
get(int index) |
int |
index() |
default boolean |
isEmpty() |
default boolean |
isPersistable(History.Entry entry)
Check if an entry should be persisted or not.
|
default ListIterator<History.Entry> |
iterator() |
ListIterator<History.Entry> |
iterator(int index) |
int |
last() |
void |
load()
Load history.
|
boolean |
moveTo(int index)
Move to the specified index in the history
|
void |
moveToEnd()
Move to the end of the history buffer.
|
boolean |
moveToFirst()
Moves the history index to the first entry.
|
boolean |
moveToLast()
This moves the history to the last entry.
|
boolean |
next()
Move the pointer to the next element in the buffer.
|
boolean |
previous()
Move the pointer to the previous element in the buffer.
|
void |
purge()
Purge history.
|
void |
read(Path file,
boolean checkDuplicates)
Read history from the file.
|
void |
resetIndex()
Reset index after remove
|
default Iterator<History.Entry> |
reverseIterator() |
default Iterator<History.Entry> |
reverseIterator(int index) |
void |
save()
Save history.
|
int |
size() |
void |
write(Path file,
boolean incremental)
Write history to the file.
|
forEach, spliterator
void attach(LineReader reader)
reader
- the reader to attach tovoid load() throws IOException
IOException
- if a problem occursvoid save() throws IOException
IOException
- if a problem occursvoid write(Path file, boolean incremental) throws IOException
file
- History fileincremental
- If true incremental write operation is performed.IOException
- if a problem occursvoid append(Path file, boolean incremental) throws IOException
file
- History fileincremental
- If true incremental append operation is performed.IOException
- if a problem occursvoid read(Path file, boolean checkDuplicates) throws IOException
true
only the events that
are not contained within the internal list are added.file
- History filecheckDuplicates
- If true
, duplicate history entries will be discardedIOException
- if a problem occursvoid purge() throws IOException
IOException
- if a problem occursint size()
default boolean isEmpty()
int index()
int first()
int last()
String get(int index)
default void add(String line)
default boolean isPersistable(History.Entry entry)
entry
- the entry to checktrue
if the given entry should be persisted, false
otherwiseListIterator<History.Entry> iterator(int index)
default ListIterator<History.Entry> iterator()
iterator
in interface Iterable<History.Entry>
default Iterator<History.Entry> reverseIterator()
default Iterator<History.Entry> reverseIterator(int index)
String current()
boolean previous()
boolean next()
boolean moveToFirst()
boolean moveToLast()
boolean moveTo(int index)
index
- The index to move to.void moveToEnd()
void resetIndex()