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) |
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) |
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 |
save()
Save history.
|
int |
size() |
Spliterator<History.Entry> |
spliterator() |
String |
toString() |
protected void |
trimHistory(Path path,
int max) |
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 purge()
throws IOException
Historypurge in interface HistoryIOException - 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 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 © 2018. All rights reserved.