de.qfs.apps.qflog.logview
Class LogParser

java.lang.Object
  |
  +--de.qfs.apps.qflog.logview.LogParser

public class LogParser
extends java.lang.Object

This parser creates LogEntries from printed log messages. It is needed to restore text log files.

The parser is not very sophisticated, but efficient.

Version:
$Revision: 1.6 $
Author:
Gregor Schmid

Inner Class Summary
static interface LogParser.ProgressCallback
          This interface can be implemented to monitor and possibly abort parsing.
static class LogParser.UnitTest
          Test cases for the LogParser class.
 
Constructor Summary
LogParser()
          Create a new LogParser.
 
Method Summary
 de.qfs.lib.log.LogEntry[] parse(java.io.BufferedReader in)
          Parse LogEntries from a Reader.
 de.qfs.lib.log.LogEntry parse(java.lang.String line)
          Parse a LogEntry from one line of input.
 void setProgressCallback(LogParser.ProgressCallback callback)
          Set the callback used to monitor or abort parsing.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LogParser

public LogParser()
Create a new LogParser.
Method Detail

setProgressCallback

public void setProgressCallback(LogParser.ProgressCallback callback)
Set the callback used to monitor or abort parsing.
Parameters:
callback -  

parse

public de.qfs.lib.log.LogEntry[] parse(java.io.BufferedReader in)
                                throws java.io.IOException
Parse LogEntries from a Reader.
Parameters:
in - The BufferedReader that feeds the lines.
Returns:
An array of parsed LogEntries.
Throws:
java.io.IOException - If the Reader causes trouble.

parse

public de.qfs.lib.log.LogEntry parse(java.lang.String line)
Parse a LogEntry from one line of input. If the parsing fails at any stage the line is considered to be a part of a preceding log message and null is returned.
Parameters:
line - The source line.
Returns:
The LogEntry or null, if the line could not be parsed.