SalesPoint v3.3 API

log
Class LogInputStream

java.lang.Object
  extended by log.LogInputStream
All Implemented Interfaces:
Serializable

public class LogInputStream
extends Object
implements Serializable

A stream that can be used to read and process log files.

The LogInputStream will take an InputStream and try to interpret the data from that stream as a log file. You can then obtain the LogEntries in the order they were put into the log by calling readEntry().

LogInputStreams can be filtered in which case you will only see the LogEntries that are accepted by the filter.

Since:
v2.0
Author:
Steffen Zschaler
See Also:
Serialized Form

Field Summary
protected  InputStream m_isSource
          The input stream that backs this stream.
protected  LogEntryFilter m_lefFilter
          The filter to be applied on the stream, if any.
protected  ObjectInputStream m_oisSource
          The object input stream that is build on top of the input stream.
 
Constructor Summary
LogInputStream(InputStream isSource)
          Create a new LogInputStream.
LogInputStream(InputStream isSource, LogEntryFilter lef)
          Create a new LogInputStream.
 
Method Summary
 void close()
          Close the stream and all streams that it relies on.
 LogEntry readEntry()
          Read the next log entry that is accepted by the filter from the stream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_isSource

protected InputStream m_isSource
The input stream that backs this stream.


m_oisSource

protected ObjectInputStream m_oisSource
The object input stream that is build on top of the input stream. This objects in this stream are expected to be LogEntries.


m_lefFilter

protected LogEntryFilter m_lefFilter
The filter to be applied on the stream, if any.

Constructor Detail

LogInputStream

public LogInputStream(InputStream isSource)
               throws IOException
Create a new LogInputStream. There will be no filter.

Parameters:
isSource - the InputStream that is the base for this stream.
Throws:
IOException - if an error occured or the stream is not a valid log file.

LogInputStream

public LogInputStream(InputStream isSource,
                      LogEntryFilter lef)
               throws IOException
Create a new LogInputStream.

Parameters:
isSource - the InputStream that is the base for this stream.
lef - the filter to be applied on the stream.
Throws:
IOException - if an error occured or the stream is not a valid log file.
Method Detail

close

public void close()
           throws IOException
Close the stream and all streams that it relies on.

Throws:
IOException - if there was an error on closing.
Override:
Never

readEntry

public LogEntry readEntry()
                   throws IOException,
                          ClassNotFoundException
Read the next log entry that is accepted by the filter from the stream.

Throws:
IOException - if an IOException occurred while reading from the underlying stream. Especially, this may be an EOFException if the end of the stream has been reached. This is the only way to find out whether there are more entries in the stream.
ClassNotFoundException - if the exception was thrown by the underlying stream.
Override:
Never

SalesPoint v3.3 API