public class FileChannelDataLogger extends Object implements IDataLogger
TAEnabledRandomAccessFile
to persist the data. If the Logger is open, it holds a lock on
This class is not thread safe . Use facades to protect instances| Constructor and Description |
|---|
FileChannelDataLogger(File logFileAccess,
AccessMode aceessMode)
Opens a logger on base of die given logfile.
|
| Modifier and Type | Method and Description |
|---|---|
void |
close()
close the Log files and perform necessary cleanup tasks.
|
void |
destroy()
destroys the logger and removes its resources.
|
AccessMode |
getAccessMode() |
boolean |
isClosed() |
void |
open(AccessMode accessMode)
opens the logger with the specified ACCESS_MODE.
|
void |
reopen(AccessMode accessMode)
reopens the datalogger.
|
void |
replay(IDataLoggerReplay replay)
the records a recovered from the format described in
write(short, byte[][]) |
String |
toString() |
void |
write(short type,
byte[] record) |
long |
write(short type,
byte[][] records)
+-- length of records[0]
+-- data of records[0]
+-- length of records[1]
+-- data of records[1]
. . .
|
public FileChannelDataLogger(File logFileAccess, AccessMode aceessMode) throws IOException
AccessMode.WRITE
, so you can start writting datelogFileAccess - IOExceptionpublic AccessMode getAccessMode()
public void open(AccessMode accessMode) throws IOException
open in interface IDataLoggeraccessMode - IOExceptionIDataLogger.reopen(org.csc.phynixx.loggersystem.logger.channellogger.AccessMode)public void reopen(AccessMode accessMode) throws IOException
reopen in interface IDataLoggeraccessMode - IOExceptionIllegalStateException - logger isn't openpublic void write(short type,
byte[] record)
throws IOException
IOExceptionpublic long write(short type,
byte[][] records)
throws IOException
+-- length of records[0]
+-- data of records[0]
+-- length of records[1]
+-- data of records[1]
. . .
this format ensures that the record could be recoveredwrite in interface IDataLoggertype - a record type defined in LogRecordType.records - IOExceptionpublic void close()
throws IOException
IDataLoggerclose in interface IDataLoggerIOExceptionpublic void replay(IDataLoggerReplay replay) throws IOException
write(short, byte[][])replay in interface IDataLoggerreplay - replayListenerIOExceptionpublic boolean isClosed()
isClosed in interface IDataLoggerpublic void destroy()
throws IOException
IDataLoggerdestroy in interface IDataLoggerIOExceptionCopyright © 2017. All rights reserved.