public class History extends Object
Constructor and Description |
---|
History()
Construstor: initialize a blank history.
|
History(File historyFile)
Construstor: initialize History object the the specified
File for
storage. |
Modifier and Type | Method and Description |
---|---|
void |
addToHistory(String buffer)
Add the specified buffer to the end of the history.
|
void |
clear()
Clear the history buffer
|
String |
current()
Return the content of the current buffer.
|
void |
flushBuffer()
Flush the entire history buffer to the output PrintWriter.
|
int |
getCurrentIndex()
Returns the current history index.
|
List<String> |
getHistoryList()
Returns an immutable list of the history buffer.
|
int |
getMaxSize()
Get the maximum size that the history buffer will store.
|
PrintWriter |
getOutput()
Returns the PrintWriter that is used to store history elements.
|
void |
load(InputStream in)
Load the history buffer from the specified InputStream.
|
void |
load(Reader reader)
Load the history buffer from the specified Reader.
|
void |
moveToEnd()
Move to the end of the history buffer.
|
boolean |
moveToFirstEntry()
Moves the history index to the first entry.
|
boolean |
moveToLastEntry()
This moves the history to the last entry.
|
boolean |
next()
Move the pointer to the next element in the buffer.
|
boolean |
previous()
Move the pointer to the previous element in the buffer.
|
void |
setHistoryFile(File historyFile) |
void |
setMaxSize(int maxSize)
Set the maximum size that the history buffer will store.
|
void |
setOutput(PrintWriter output)
The output to which all history elements will be written (or null of
history is not saved to a buffer).
|
int |
size() |
String |
toString()
Returns the standard
AbstractCollection.toString() representation
of the history list. |
public History()
public History(File historyFile) throws IOException
File
for
storage.IOException
public void setHistoryFile(File historyFile) throws IOException
IOException
public void load(InputStream in) throws IOException
IOException
public void load(Reader reader) throws IOException
IOException
public int size()
public void clear()
public void addToHistory(String buffer)
public void flushBuffer() throws IOException
IOException
public boolean moveToLastEntry()
public void moveToEnd()
public void setMaxSize(int maxSize)
public int getMaxSize()
public void setOutput(PrintWriter output)
public PrintWriter getOutput()
public int getCurrentIndex()
public String current()
public boolean previous()
public boolean next()
public List<String> getHistoryList()
public String toString()
AbstractCollection.toString()
representation
of the history list.public boolean moveToFirstEntry()
Copyright © 2024. All rights reserved.