org.openmdx.kernel.log
Interface LogEntityReader

All Known Implementing Classes:
LogFileParser

public interface LogEntityReader

Defines the interface for log entity readers


Method Summary
 int readBinary(long startPos, byte[] buffer)
          Reads from a start position a given number of bytes from the log file.
 long readLogEvents(long startPos, int maxEvents, long maxProcessingTime, LogEventFilter filter, ArrayList eventList)
          Parses the log entity for log events.
 long readLogEvents(long startPos, int maxEvents, long maxProcessingTime, LogEventFilter filter, ObjectOutputStream target)
           
 long size()
          Returns the size of the log entity in bytes
 

Method Detail

readLogEvents

long readLogEvents(long startPos,
                   int maxEvents,
                   long maxProcessingTime,
                   LogEventFilter filter,
                   ArrayList eventList)
                   throws IOException,
                          UnsupportedOperationException
Parses the log entity for log events. Returns at most events log events. If the start position is >0 the parser seeks to next starting log event.

If the file position is a positive number the reading starts from the given file position. If the given file position is a negative number it is used as offset from the end of the file.

Be prepared that the requested number of events can be limited.

The parser returns if either the end of the file is reached, the max number of events is parsed or the max processing time is exceeded.

Parameters:
startPos - The start position where the parsing starts
maxEvents - The max number of events to be processed
maxProcessingTime - The max processing time in milliseconds. A value of 0 means no time limit.
filter - A log event filter
eventList - The event list to be filled with the parsed
Returns:
The file position after reading all the events
Throws:
IOException - Thrown if file does not exist or cannot be read
UnsupportedOperationException - if readig log events is not supported on the currently used log entity

readLogEvents

long readLogEvents(long startPos,
                   int maxEvents,
                   long maxProcessingTime,
                   LogEventFilter filter,
                   ObjectOutputStream target)
                   throws IOException,
                          UnsupportedOperationException
Throws:
IOException
UnsupportedOperationException

readBinary

int readBinary(long startPos,
               byte[] buffer)
               throws IOException,
                      UnsupportedOperationException
Reads from a start position a given number of bytes from the log file.

Note that not all log entities may support binary reading.

Parameters:
startPos - The start position where the parsing starts
buffer - The allocated buffer to receive the file data
Returns:
The number of bytes read. 0 indicates EOF
Throws:
IOException - Thrown if file does not exist or cannot be read
UnsupportedOperationException - if binary read is not supported on the currently used log entity

size

long size()
          throws IOException,
                 UnsupportedOperationException
Returns the size of the log entity in bytes

Returns:
The log entity size
Throws:
IOException - Thrown if file does not exist or cannot be read
UnsupportedOperationException - if the entity size is not supported on the currently used log entity


This software is published under the BSD license. Copyright © 2003-2007, OMEX AG, Switzerland, All rights reserved. Use is subject to license terms.