org.crosswire.jsword.book.sword.state

## Class ZVerseBackendState

- java.lang.Object
- - org.crosswire.jsword.book.sword.state.AbstractOpenFileState
  - - org.crosswire.jsword.book.sword.state.ZVerseBackendState

- All Implemented Interfaces:
    Closeable, AutoCloseable, OpenFileState

      public class ZVerseBackendState
      extends AbstractOpenFileState

  Stores the random access files required for processing the passage request. The caller is required to close to correctly free resources and avoid File pointer leaks.
  Author:
    DM Smith
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private long` | `lastBlockNum`
    `private Testament` | `lastTestament`
    `private byte[]` | `lastUncompressed`
    `private static org.slf4j.Logger` | `LOGGER` The log stream
    `private RandomAccessFile` | `ntCompRaf`
    `private RandomAccessFile` | `ntIdxRaf`
    `private RandomAccessFile` | `ntTextRaf`
    `private RandomAccessFile` | `otCompRaf` The compressed random access files
    `private RandomAccessFile` | `otIdxRaf` The index random access files
    `private RandomAccessFile` | `otTextRaf` The data random access files
    `private static String` | `SUFFIX_COMP`
    `private static String` | `SUFFIX_INDEX`
    `private static String` | `SUFFIX_PART1`
    `private static String` | `SUFFIX_TEXT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZVerseBackendState(BookMetaData bookMetaData, BlockType blockType)` This is default package access for forcing the use of the OpenFileStateManager to manage the creation.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `RandomAccessFile` | `getCompRaf(Testament testament)` Get the compression file for the given testament.
    `RandomAccessFile` | `getIdxRaf(Testament testament)` Get the index file for the given testament.
    `long` | `getLastBlockNum()`
    `Testament` | `getLastTestament()`
    `byte[]` | `getLastUncompressed()`
    `RandomAccessFile` | `getTextRaf(Testament testament)` Get the text file for the given testament.
    `void` | `releaseResources()`
    `void` | `setLastBlockNum(long lastBlockNum)`
    `void` | `setLastTestament(Testament lastTestament)`
    `void` | `setLastUncompressed(byte[] lastUncompressed)`

    - ### Methods inherited from class org.crosswire.jsword.book.sword.state.AbstractOpenFileState

      `close, getBookMetaData, getLastAccess, setLastAccess`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### SUFFIX_COMP

          private static final String SUFFIX_COMP

      See Also:
        Constant Field Values

    - #### SUFFIX_INDEX

          private static final String SUFFIX_INDEX

      See Also:
        Constant Field Values

    - #### SUFFIX_PART1

          private static final String SUFFIX_PART1

      See Also:
        Constant Field Values

    - #### SUFFIX_TEXT

          private static final String SUFFIX_TEXT

      See Also:
        Constant Field Values

    - #### otCompRaf

          private RandomAccessFile otCompRaf

      The compressed random access files

    - #### ntCompRaf

          private RandomAccessFile ntCompRaf

    - #### otTextRaf

          private RandomAccessFile otTextRaf

      The data random access files

    - #### ntTextRaf

          private RandomAccessFile ntTextRaf

    - #### otIdxRaf

          private RandomAccessFile otIdxRaf

      The index random access files

    - #### ntIdxRaf

          private RandomAccessFile ntIdxRaf

    - #### lastTestament

          private Testament lastTestament

    - #### lastBlockNum

          private long lastBlockNum

    - #### lastUncompressed

          private byte[] lastUncompressed

    - #### LOGGER

          private static final org.slf4j.Logger LOGGER

      The log stream

  - ### Constructor Detail

    - #### ZVerseBackendState

          ZVerseBackendState(BookMetaData bookMetaData,
                            BlockType blockType)
                       throws BookException

      This is default package access for forcing the use of the OpenFileStateManager to manage the creation. Not doing so may result in new instances of OpenFileState being created for no reason, and as a result, if they are released to the OpenFileStateManager by mistake this would result in leakage
      Parameters:
        `bookMetaData` - the appropriate metadata for the book
      Throws:
        `BookException`

  - ### Method Detail

    - #### releaseResources

          public void releaseResources()

    - #### getCompRaf

          public RandomAccessFile getCompRaf(Testament testament)

      Get the compression file for the given testament.
      Parameters:
        `testament` - the testament for the index
      Returns:
        the index for the testament

    - #### getTextRaf

          public RandomAccessFile getTextRaf(Testament testament)

      Get the text file for the given testament.
      Parameters:
        `testament` - the testament for the index
      Returns:
        the index for the testament

    - #### getIdxRaf

          public RandomAccessFile getIdxRaf(Testament testament)

      Get the index file for the given testament.
      Parameters:
        `testament` - the testament for the index
      Returns:
        the index for the testament

    - #### getLastTestament

          public Testament getLastTestament()

      Returns:
        the lastTestament

    - #### getLastBlockNum

          public long getLastBlockNum()

      Returns:
        the lastBlockNum

    - #### getLastUncompressed

          public byte[] getLastUncompressed()

      Returns:
        the lastUncompressed

    - #### setLastTestament

          public void setLastTestament(Testament lastTestament)

      Parameters:
        `lastTestament` - the lastTestament to set

    - #### setLastBlockNum

          public void setLastBlockNum(long lastBlockNum)

      Parameters:
        `lastBlockNum` - the lastBlockNum to set

    - #### setLastUncompressed

          public void setLastUncompressed(byte[] lastUncompressed)

      Parameters:
        `lastUncompressed` - the lastUncompressed to set