org.jscience.util.logging
Class BinaryFileLog
java.lang.Object
org.jscience.util.logging.AbstractLogWriter
org.jscience.util.logging.BinaryFileLog
- All Implemented Interfaces:
- Filter<LogEntry>, LogWriter
public class BinaryFileLog
- extends AbstractLogWriter
A LogWriter that logs the entries synchronously serialized to a file.
The implementation assumes that all given parameters in a LogEntry are
serializable. To read from a BinaryFileLog, you can also use the
ObjectEnumerator from the class org.jscience.io.ExtendedFile
.
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 org.jscience.io.IOUtils
class.
- Since:
- 12/22/2002
- See Also:
ExtendedFile.objectEnumerator(boolean)
,
IOUtils.deserialize(byte[])
Constructor Summary |
BinaryFileLog(java.io.File file,
boolean keepConnectionAlive,
boolean append)
Creates a new BinaryFileLog object. |
Method Summary |
void |
close()
DOCUMENT ME! |
protected void |
finalize()
DOCUMENT ME! |
void |
writeLogEntry(java.lang.Object pattern)
writes the complete serialized information and flushes
synchronously |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
BinaryFileLog
public BinaryFileLog(java.io.File file,
boolean keepConnectionAlive,
boolean append)
throws java.io.IOException
- Creates a new BinaryFileLog object.
- Parameters:
file
- DOCUMENT ME!keepConnectionAlive
- DOCUMENT ME!append
- DOCUMENT ME!
- Throws:
java.io.IOException
- DOCUMENT ME!
writeLogEntry
public void writeLogEntry(java.lang.Object pattern)
throws LogException
- writes the complete serialized information and flushes
synchronously
- Specified by:
writeLogEntry
in class AbstractLogWriter
- Parameters:
pattern
- DOCUMENT ME!
- Throws:
LogException
- DOCUMENT ME!
close
public void close()
throws java.io.IOException
- DOCUMENT ME!
- Throws:
java.io.IOException
- DOCUMENT ME!
finalize
protected void finalize()
throws java.io.IOException
- DOCUMENT ME!
- Overrides:
finalize
in class java.lang.Object
- Throws:
java.io.IOException
- DOCUMENT ME!