org.salespointframework.core.logging
Class LogInputStream

java.lang.Object
  extended by org.salespointframework.core.logging.LogInputStream

public class LogInputStream
extends java.lang.Object

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
Version:
2.0 14/07/1999
Author:
Steffen Zschaler

Field Summary
protected  java.io.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  java.io.ObjectInputStream m_oisSource
          The object input stream that is build on top of the input stream.
 
Constructor Summary
LogInputStream(java.io.InputStream isSource)
          Create a new LogInputStream.
LogInputStream(java.io.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 java.io.InputStream m_isSource
The input stream that backs this stream.


m_oisSource

protected java.io.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(java.io.InputStream isSource)
               throws java.io.IOException
Create a new LogInputStream. There will be no filter.

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

LogInputStream

public LogInputStream(java.io.InputStream isSource,
                      LogEntryFilter lef)
               throws java.io.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:
java.io.IOException - if an error occured or the stream is not a valid log file.
Method Detail

close

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

Throws:
java.io.IOException - if there was an error on closing.

readEntry

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

Throws:
java.io.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.
java.lang.ClassNotFoundException - if the exception was thrown by the underlying stream.