jline.console.history
Class FileHistory
java.lang.Object
jline.console.history.MemoryHistory
jline.console.history.FileHistory
- All Implemented Interfaces:
- java.io.Flushable, java.lang.Iterable<History.Entry>, History, PersistentHistory
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.
- Since:
- 2.0
- Author:
- Jason Dillon
Method Summary |
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() . |
Methods inherited from class jline.console.history.MemoryHistory |
add, clear, current, entries, entries, get, getMaxSize, index, isAutoTrim, isEmpty, isIgnoreDuplicates, iterator, moveTo, moveToEnd, moveToFirst, moveToLast, next, previous, replace, setAutoTrim, setIgnoreDuplicates, setMaxSize, size |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface jline.console.history.History |
add, clear, current, entries, entries, get, index, isEmpty, iterator, moveTo, moveToEnd, moveToFirst, moveToLast, next, previous, replace, size |
FileHistory
public FileHistory(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
getFile
public java.io.File getFile()
load
public void load(java.io.File file)
throws java.io.IOException
- Throws:
java.io.IOException
load
public void load(java.io.InputStream input)
throws java.io.IOException
- Throws:
java.io.IOException
load
public void load(java.io.Reader reader)
throws java.io.IOException
- Throws:
java.io.IOException
flush
public void flush()
throws java.io.IOException
- Description copied from interface:
PersistentHistory
- Flush all items to persistent storage.
- Specified by:
flush
in interface java.io.Flushable
- Specified by:
flush
in interface PersistentHistory
- Throws:
java.io.IOException
- Flush failed
purge
public void purge()
throws java.io.IOException
- Description copied from interface:
PersistentHistory
- Purge persistent storage and
History.clear()
.
- Specified by:
purge
in interface PersistentHistory
- Throws:
java.io.IOException
- Purge failed