Modifier and Type | Method and Description |
---|---|
static History |
create(File log,
OutputModel outputModel,
InputModel inputModel)
Creates a new
History that manages historical events generated by
the user. |
Void |
startReading(HistoryVisitor visitor)
Starts parsing the log file with the specified visitor, if the log file
exists.
|
void |
stopReading(HistoryVisitor visitor)
Stops reading the log file with the specified visitor.
|
public static History create(File log, OutputModel outputModel, InputModel inputModel)
History
that manages historical events generated by
the user.log
- the log file to read and write from.outputModel
- the OutputModel
to listen toinputModel
- the InputModel
to listen toHistory
object if the log file can be
written to, otherwise a new History
object that does
nothing.public Void startReading(HistoryVisitor visitor) throws IOException
This method blocks until the log file is completely parsed, during which time visitor methods are called from the context of the current thread. After this method has returned, the visitor's methods will be called from various threads. It is guaranteed that two visitor's methods will not be concurrently executed.
If the log file is unavailable, this method returns immediately and no methods on the visitor will be called.
visitor
- the visitor to registerIOException
- if an I/O error occurspublic void stopReading(HistoryVisitor visitor)
visitor
- the visitor to unregisterCopyright © 2015 Kreatious LLC. All rights reserved.