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
DEFAULT_MAX_SIZE
Constructor and Description |
---|
FileHistory(java.io.File file)
Load a history file into memory, truncating to default max size.
|
FileHistory(java.io.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.
|
java.io.File |
getFile() |
void |
load()
Load history from file, e.g. if using delayed init.
|
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, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
public FileHistory(java.io.File file) throws java.io.IOException
java.io.IOException
public FileHistory(java.io.File file, boolean doInit) throws java.io.IOException
java.io.IOException
public void load() throws java.io.IOException
java.io.IOException
public java.io.File getFile()
public void load(java.io.File file) throws java.io.IOException
java.io.IOException
public void load(java.io.InputStream input) throws java.io.IOException
java.io.IOException
public void load(java.io.Reader reader) throws java.io.IOException
java.io.IOException
public void flush() throws java.io.IOException
PersistentHistory
flush
in interface java.io.Flushable
flush
in interface PersistentHistory
java.io.IOException
- Flush failedpublic void purge() throws java.io.IOException
PersistentHistory
History.clear()
.purge
in interface PersistentHistory
java.io.IOException
- Purge failedCopyright © 2018. All Rights Reserved.