bitronix.tm.journal
Class TransactionLogCursor

java.lang.Object
  extended by bitronix.tm.journal.TransactionLogCursor

public class TransactionLogCursor
extends Object

Used to read TransactionLogRecord objects from a log file.

Author:
lorban

Constructor Summary
TransactionLogCursor(File file)
          Create a TransactionLogCursor that will read from the specified file.
 
Method Summary
 void close()
          Close the cursor and the underlying file
 TransactionLogRecord readLog()
          Fetch the next TransactionLogRecord from log, recalculating the CRC and checking it against the stored one.
 TransactionLogRecord readLog(boolean skipCrcCheck)
          Fetch the next TransactionLogRecord from log.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransactionLogCursor

public TransactionLogCursor(File file)
                     throws IOException
Create a TransactionLogCursor that will read from the specified file. This opens a new read-only file descriptor.

Parameters:
file - the file to read logs from
Throws:
IOException - if an I/O error occurs.
Method Detail

readLog

public TransactionLogRecord readLog()
                             throws IOException
Fetch the next TransactionLogRecord from log, recalculating the CRC and checking it against the stored one. InvalidChecksumException is thrown if the check fails.

Returns:
the TransactionLogRecord or null if the end of the log file has been reached
Throws:
IOException - if an I/O error occurs.

readLog

public TransactionLogRecord readLog(boolean skipCrcCheck)
                             throws IOException
Fetch the next TransactionLogRecord from log.

Parameters:
skipCrcCheck - if set to false, the method will thow an InvalidChecksumException if the CRC on disk does not match the recalculated one. Otherwise, the CRC is not recalculated nor checked agains the stored one.
Returns:
the TransactionLogRecord or null if the end of the log file has been reached
Throws:
IOException - if an I/O error occurs.

close

public void close()
           throws IOException
Close the cursor and the underlying file

Throws:
IOException - if an I/O error occurs.


Copyright © 2006-2013 Bitronix Software. All Rights Reserved.