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.Entry
DEFAULT_MAX_SIZE
Constructor and Description |
---|
FileHistory(File file) |
Modifier and Type | Method and Description |
---|---|
void |
flush()
Flush all items to persistent storage.
|
File |
getFile() |
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, toString
public FileHistory(File file) throws IOException
IOException
public File getFile()
public void load(File file) throws IOException
IOException
public void load(InputStream input) throws IOException
IOException
public void load(Reader reader) throws IOException
IOException
public void flush() throws IOException
PersistentHistory
flush
in interface Flushable
flush
in interface PersistentHistory
IOException
- Flush failedpublic void purge() throws IOException
PersistentHistory
History.clear()
.purge
in interface PersistentHistory
IOException
- Purge failedCopyright © 2017. All Rights Reserved.