public class FileHistory extends MemoryHistory implements PersistentHistory, Flushable
History using a file for persistent backing.
Implementers should install shutdown hook to call flush()
to save history to disk.History.EntryDEFAULT_MAX_SIZE| Constructor and Description |
|---|
FileHistory(File file)
Load a history file into memory, truncating to default max size.
|
FileHistory(File file,
boolean doInit)
Create a FileHistory, but only initialize if doInit is true.
|
| Modifier and Type | Method and Description |
|---|---|
void |
flush()
Flush all items to persistent storage.
|
File |
getFile() |
void |
load()
Load history from file, e.g.
|
void |
load(File file) |
void |
load(InputStream input) |
void |
load(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, waitadd, clear, current, entries, entries, get, index, isEmpty, iterator, moveTo, moveToEnd, moveToFirst, moveToLast, next, previous, remove, removeFirst, removeLast, replace, set, sizeforEach, spliteratorpublic FileHistory(File file) throws IOException
IOExceptionpublic FileHistory(File file, boolean doInit) throws IOException
IOExceptionpublic void load()
throws IOException
IOExceptionpublic File getFile()
public void load(File file) throws IOException
IOExceptionpublic void load(InputStream input) throws IOException
IOExceptionpublic void load(Reader reader) throws IOException
IOExceptionpublic void flush()
throws IOException
PersistentHistoryflush in interface Flushableflush in interface PersistentHistoryIOException - Flush failedpublic void purge()
throws IOException
PersistentHistoryHistory.clear().purge in interface PersistentHistoryIOException - Purge failedCopyright © 2025. All rights reserved.