public class FileHistory extends MemoryHistory implements PersistentHistory, java.io.Flushable
History using a file for persistent backing.
Implementers should install shutdown hook to call flush()
to save history to disk.History.Entry| Modifier and Type | Field and Description |
|---|---|
private java.io.File |
file |
DEFAULT_MAX_SIZE| Constructor and Description |
|---|
FileHistory(java.io.File file) |
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flush all items to persistent storage.
|
java.io.File |
getFile() |
void |
load(java.io.File file) |
void |
load(java.io.InputStream input) |
void |
load(java.io.Reader reader) |
void |
purge()
Purge persistent storage and
History.clear(). |
add, clear, current, entries, entries, get, getMaxSize, index, internalAdd, isAutoTrim, isEmpty, isIgnoreDuplicates, iterator, moveTo, moveToEnd, moveToFirst, moveToLast, next, previous, remove, removeFirst, removeLast, replace, set, setAutoTrim, setIgnoreDuplicates, setMaxSize, size, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic FileHistory(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic java.io.File getFile()
public void load(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic void load(java.io.InputStream input)
throws java.io.IOException
java.io.IOExceptionpublic void load(java.io.Reader reader)
throws java.io.IOException
java.io.IOExceptionpublic void flush()
throws java.io.IOException
PersistentHistoryflush in interface java.io.Flushableflush in interface PersistentHistoryjava.io.IOException - Flush failedpublic void purge()
throws java.io.IOException
PersistentHistoryHistory.clear().purge in interface PersistentHistoryjava.io.IOException - Purge failed