org.crosswire.jsword.book.sword.state

## Class ZLDBackendState

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

- All Implemented Interfaces:
    Closeable, AutoCloseable, OpenFileState

      public class ZLDBackendState
      extends RawLDBackendState

  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 static byte[]` | `EMPTY_BYTES`
    `private static String` | `EXTENSION_Z_DATA`
    `private static String` | `EXTENSION_Z_INDEX`
    `private long` | `lastBlockNum` The index of the block that is cached.
    `private byte[]` | `lastUncompressed` The cache for a read of a compressed block.
    `private static org.slf4j.Logger` | `LOGGER` The log stream
    `private File` | `zdtFile` The compressed text.
    `private RandomAccessFile` | `zdtRaf` The compressed text random access file.
    `private File` | `zdxFile` The compressed index.
    `private RandomAccessFile` | `zdxRaf` The compressed index random access file.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ZLDBackendState(BookMetaData bookMetaData)` 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
    --- | ---
    `long` | `getLastBlockNum()`
    `byte[]` | `getLastUncompressed()`
    `RandomAccessFile` | `getZdtRaf()`
    `RandomAccessFile` | `getZdxRaf()`
    `void` | `releaseResources()`
    `void` | `setLastBlockNum(long lastBlockNum)`
    `void` | `setLastUncompressed(byte[] lastUncompressed)`

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

      `getDatRaf, getIdxFile, getIdxRaf, getSize, setSize`

    - ### 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

    - #### EMPTY_BYTES

          private static final byte[] EMPTY_BYTES

    - #### EXTENSION_Z_INDEX

          private static final String EXTENSION_Z_INDEX

      See Also:
        Constant Field Values

    - #### EXTENSION_Z_DATA

          private static final String EXTENSION_Z_DATA

      See Also:
        Constant Field Values

    - #### zdxFile

          private File zdxFile

      The compressed index.

    - #### zdxRaf

          private RandomAccessFile zdxRaf

      The compressed index random access file.

    - #### zdtFile

          private File zdtFile

      The compressed text.

    - #### zdtRaf

          private RandomAccessFile zdtRaf

      The compressed text random access file.

    - #### lastBlockNum

          private long lastBlockNum

      The index of the block that is cached.

    - #### lastUncompressed

          private byte[] lastUncompressed

      The cache for a read of a compressed block.

    - #### LOGGER

          private static final org.slf4j.Logger LOGGER

      The log stream

  - ### Constructor Detail

    - #### ZLDBackendState

          ZLDBackendState(BookMetaData bookMetaData)
                    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()

      Specified by:
        `releaseResources` in interface `OpenFileState`
      Overrides:
        `releaseResources` in class `RawLDBackendState`

    - #### getZdxRaf

          public RandomAccessFile getZdxRaf()

      Returns:
        the zdxRaf

    - #### getZdtRaf

          public RandomAccessFile getZdtRaf()

      Returns:
        the zdtRaf

    - #### getLastBlockNum

          public long getLastBlockNum()

      Returns:
        the lastBlockNum

    - #### getLastUncompressed

          public byte[] getLastUncompressed()

      Returns:
        the lastUncompressed

    - #### setLastBlockNum

          public void setLastBlockNum(long lastBlockNum)

      Parameters:
        `lastBlockNum` - the lastBlockNum to set

    - #### setLastUncompressed

          public void setLastUncompressed(byte[] lastUncompressed)

      Parameters:
        `lastUncompressed` - the lastUncompressed to set