## org.exist.storage.journal
Class JournalReader

    java.lang.Object
      org.exist.storage.journal.JournalReader

public class JournalReader
extends java.lang.Object

Read log entries from the journal file. This class is used during recovery to scan the last journal file. It uses a memory-mapped byte buffer on the file. Journal entries can be read forward (during redo) or backward (during undo).

Author:
  wolf

Constructor Summary
`JournalReader(DBBroker broker, java.io.File file, int fileNumber)` Opens the specified file for reading.

Method Summary
`void` `close()`
`Loggable` `lastEntry()`
`Loggable` `nextEntry()` Returns the next entry found from the current position.
`void` `position(long lsn)` Re-position the file position so it points to the start of the entry with the given LSN.
`Loggable` `previousEntry()` Returns the previous entry found by scanning backwards from the current position.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JournalReader

    public JournalReader(DBBroker broker,
                         java.io.File file,
                         int fileNumber)
                  throws LogException

  Opens the specified file for reading.

Parameters:
  `broker` -
  `file` -
  `fileNumber` -
Throws:
  `LogException`

Method Detail

### nextEntry

    public Loggable nextEntry()
                       throws LogException

  Returns the next entry found from the current position.

  Returns:
    the next entry
  Throws:
    `LogException` - if an entry could not be read due to an inconsistency on disk.

### previousEntry

    public Loggable previousEntry()
                           throws LogException

  Returns the previous entry found by scanning backwards from the current position.

  Returns:
    the previous entry
  Throws:
    `LogException` - if an entry could not be read due to an inconsistency on disk.
    `java.io.IOException`

### lastEntry

    public Loggable lastEntry()
                       throws LogException

  Throws:
    `LogException`

### position

    public void position(long lsn)
                  throws LogException

  Re-position the file position so it points to the start of the entry with the given LSN.

  Parameters:
    `lsn` -
  Throws:
    `java.io.IOException`
    `LogException`

### close

    public void close()

Copyright (C) Wolfgang Meier. All rights reserved.