public class DefaultHistory extends Object implements History
| Modifier and Type | Class and Description |
|---|---|
protected static class |
DefaultHistory.EntryImpl |
History.Entry| Modifier and Type | Field and Description |
|---|---|
static int |
DEFAULT_HISTORY_FILE_SIZE |
static int |
DEFAULT_HISTORY_SIZE |
| Constructor and Description |
|---|
DefaultHistory() |
DefaultHistory(LineReader reader) |
| Modifier and Type | Method and Description |
|---|---|
void |
add(Instant time,
String line) |
protected void |
addHistoryLine(Path path,
String line) |
protected void |
addHistoryLine(Path path,
String line,
boolean checkDuplicates) |
void |
append(Path file,
boolean incremental)
Append history to the file.
|
void |
attach(LineReader reader)
Initialize the history for the given reader.
|
protected DefaultHistory.EntryImpl |
createEntry(int index,
Instant time,
String line)
Create a history entry.
|
String |
current()
Return the content of the current buffer.
|
int |
first() |
String |
get(int index) |
int |
index() |
protected void |
internalAdd(Instant time,
String line) |
protected void |
internalAdd(Instant time,
String line,
boolean checkDuplicates) |
boolean |
isEmpty() |
ListIterator<History.Entry> |
iterator(int index) |
int |
last() |
void |
load()
Load history.
|
protected boolean |
matchPatterns(String patterns,
String line) |
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 incremental)
Read history from the file.
|
void |
resetIndex()
Reset index after remove
|
void |
save()
Save history.
|
int |
size() |
Spliterator<History.Entry> |
spliterator() |
String |
toString() |
protected void |
trimHistory(Path path,
int max) |
void |
write(Path file,
boolean incremental)
Write history to the file.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitadd, isPersistable, iterator, reverseIterator, reverseIteratorpublic static final int DEFAULT_HISTORY_SIZE
public static final int DEFAULT_HISTORY_FILE_SIZE
public DefaultHistory()
public DefaultHistory(LineReader reader)
public void attach(LineReader reader)
Historypublic void load()
throws IOException
Historyload in interface HistoryIOException - if a problem occurspublic void read(Path file, boolean incremental) throws IOException
Historyread in interface Historyfile - History fileincremental - If true incremental read operation is performed.IOException - if a problem occurspublic void purge()
throws IOException
Historypurge in interface HistoryIOException - if a problem occurspublic void write(Path file, boolean incremental) throws IOException
Historywrite in interface Historyfile - History fileincremental - If true incremental write operation is performed.IOException - if a problem occurspublic void append(Path file, boolean incremental) throws IOException
Historyappend in interface Historyfile - History fileincremental - If true incremental append operation is performed.IOException - if a problem occurspublic void save()
throws IOException
Historysave in interface HistoryIOException - if a problem occursprotected void trimHistory(Path path, int max) throws IOException
IOExceptionprotected DefaultHistory.EntryImpl createEntry(int index, Instant time, String line)
index - index of history entrytime - entry creation timeline - the entry textpublic ListIterator<History.Entry> iterator(int index)
public Spliterator<History.Entry> spliterator()
spliterator in interface Iterable<History.Entry>public void resetIndex()
HistoryresetIndex in interface Historypublic boolean moveToLast()
moveToLast in interface Historypublic boolean moveTo(int index)
public boolean moveToFirst()
moveToFirst in interface Historypublic void moveToEnd()
public String current()
public boolean previous()
public boolean next()
Copyright © 2020. All rights reserved.