public abstract class AbstractAuditEventReader extends Object implements AuditEventReader
readNext() method, which parses an
audit event object from the underlying file/stream.| Modifier and Type | Field and Description |
|---|---|
protected double |
bytesRead
The number of bytes read so far (this is of type double to allow an efficient conversion to the fraction value)
|
protected int |
counter
A counter of all events read by this reader
|
static String |
DEFAULT_AUDIT_EVENT_FACTORY_CLASS |
protected boolean |
eofReached
A flag indicating if the end of file/stream has been reached
|
protected AuditEventFactory |
eventFactory
The factory used for creating audit-events
|
protected double |
fileSize
The size of the file which this reader reads from
|
protected File |
inputFile
The file to read from
|
protected AuditEvent |
pending
The currently pending event
|
protected BufferedReader |
reader
The reader which is used for reading
|
| Constructor and Description |
|---|
AbstractAuditEventReader(InputStream in)
This constructor creates a new AbstractAuditEventReader by initializing the
basic reader instance to read from the given stream.
|
AbstractAuditEventReader(Reader in)
This constructor creates a new AbstractAuditEventReader by initializing the
basic reader instance to read from the given stream.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
atEOF() |
long |
bytesAvailable() |
long |
bytesRead() |
void |
close() |
double |
getDataRead()
Returns the number of bytes that have been read.
|
double |
getFileSize()
Returns the number of bytes that are available in the file.
|
static int |
getSectionIndex(String line)
This method returns the index of the section, that the given line maps to.
|
boolean |
hasNext()
Deprecated.
|
abstract AuditEvent |
readNext()
This method tries to read the next event that is available.
|
public static final String DEFAULT_AUDIT_EVENT_FACTORY_CLASS
protected BufferedReader reader
protected AuditEventFactory eventFactory
protected File inputFile
protected int counter
protected double fileSize
protected double bytesRead
protected AuditEvent pending
protected boolean eofReached
public AbstractAuditEventReader(InputStream in)
public AbstractAuditEventReader(Reader in)
public static int getSectionIndex(String line)
line - A section boundary line.public double getFileSize()
-1.0 if the reader is reading
from a stream.public double getDataRead()
public abstract AuditEvent readNext() throws IOException, ParseException
AuditEventReaderreadNext in interface AuditEventReaderNULL if no event is available.IOExceptionParseExceptionAuditEventReader.readNext()public boolean hasNext()
true, if there is another event pending.public void close()
throws IOException
close in interface AuditEventReaderIOExceptionAuditEventReader.close()public long bytesRead()
bytesRead in interface AuditEventReaderAuditEventReader.bytesRead()public long bytesAvailable()
bytesAvailable in interface AuditEventReaderAuditEventReader.bytesAvailable()public boolean atEOF()
atEOF in interface AuditEventReaderCopyright © 2015 jwall.org. All Rights Reserved.