Holger's
Java API

com.antelmann.util.logging
Class BinaryFileLog

java.lang.Object
  extended by com.antelmann.util.logging.AbstractLogWriter<byte[]>
      extended by com.antelmann.util.logging.BinaryFileLog
All Implemented Interfaces:
Filter<LogEntry>, LogWriter

public class BinaryFileLog
extends AbstractLogWriter<byte[]>

A LogWriter that logs the entries synchronously serialized to a file. The implementation utilizes a BinaryLogFormatter. To read from a BinaryFileLog, you can also use the ObjectEnumerator from the class com.antelmann.io.MyFile. Note that if the BinaryFileLog was initialized with either the option keepConnectionAlive set to false or the option append set to true, the individual log entries are separately serialized and written as byte[]; so if you want to recover the LogEntry objects, you'll need to deserialize then. For the deserialization, you can use the com.antelmann.io.Data class.

Since:
12/22/2002
Author:
Holger Antelmann
See Also:
BinaryLogFormatter, MyFile.objectEnumerator(boolean), Data.deserialize(byte[])

Field Summary
 
Fields inherited from class com.antelmann.util.logging.AbstractLogWriter
filter
 
Fields inherited from interface com.antelmann.util.Filter
EXCLUDE_ALL_FILTER, INCLUDE_ALL_FILTER
 
Constructor Summary
BinaryFileLog(File file, boolean keepConnectionAlive, boolean append)
           
 
Method Summary
 void close()
           
protected  void finalize()
           
 void writeLogPattern(byte[] pattern)
          writes the complete serialized information and flushes synchronously
 
Methods inherited from class com.antelmann.util.logging.AbstractLogWriter
accept, getLogFilter, getLogFormatter, setLogFilter, setLogFormatter, write
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BinaryFileLog

public BinaryFileLog(File file,
                     boolean keepConnectionAlive,
                     boolean append)
              throws IOException
Throws:
IOException
Method Detail

writeLogPattern

public void writeLogPattern(byte[] pattern)
                     throws LogException
writes the complete serialized information and flushes synchronously

Specified by:
writeLogPattern in class AbstractLogWriter<byte[]>
Throws:
LogException

close

public void close()
           throws IOException
Throws:
IOException

finalize

protected void finalize()
                 throws IOException
Overrides:
finalize in class Object
Throws:
IOException


(c) Holger Antelmann since 2001- all rights reserved (contact: info@antelmann.com)
see www.antelmann.com/developer for further details and available downloads