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.EntryDEFAULT_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, toStringclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitpublic FileHistory(java.io.File file)
throws java.io.IOException
java.io.IOExceptionpublic FileHistory(java.io.File file,
boolean doInit)
throws java.io.IOException
java.io.IOExceptionpublic void load()
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 failedCopyright © 2018. All Rights Reserved.