org.crosswire.jsword.book.sword.state

## Class RawBackendState

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

- All Implemented Interfaces:
    Closeable, AutoCloseable, OpenFileState
  Direct Known Subclasses:
    RawFileBackendState

      public class RawBackendState
      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 static org.slf4j.Logger` | `LOGGER` The log stream
    `protected File` | `ntIdxFile`
    `protected RandomAccessFile` | `ntIdxRaf`
    `protected File` | `ntTextFile`
    `protected RandomAccessFile` | `ntTextRaf`
    `protected File` | `otIdxFile`
    `protected RandomAccessFile` | `otIdxRaf`
    `protected File` | `otTextFile`
    `protected RandomAccessFile` | `otTextRaf`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RawBackendState(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
    --- | ---
    `File` | `getIdxFile(Testament testament)` Get the index file for the given testament.
    `RandomAccessFile` | `getIdxRaf(Testament testament)` Get the index file for the given testament.
    `RandomAccessFile` | `getNtTextRaf()`
    `RandomAccessFile` | `getOtTextRaf()`
    `File` | `getTextFile(Testament testament)` Get the text file for the given testament.
    `RandomAccessFile` | `getTextRaf(Testament testament)` Get the text file for the given testament.
    `boolean` | `isWritable()`
    `void` | `releaseResources()`

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

    - #### otIdxRaf

          protected RandomAccessFile otIdxRaf

    - #### ntIdxRaf

          protected RandomAccessFile ntIdxRaf

    - #### otTextRaf

          protected RandomAccessFile otTextRaf

    - #### ntTextRaf

          protected RandomAccessFile ntTextRaf

    - #### ntIdxFile

          protected File ntIdxFile

    - #### ntTextFile

          protected File ntTextFile

    - #### otIdxFile

          protected File otIdxFile

    - #### otTextFile

          protected File otTextFile

    - #### LOGGER

          private static final org.slf4j.Logger LOGGER

      The log stream

  - ### Constructor Detail

    - #### RawBackendState

          RawBackendState(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

    - #### isWritable

          public boolean isWritable()

    - #### releaseResources

          public void releaseResources()

    - #### getIdxRaf

          public RandomAccessFile getIdxRaf(Testament testament)

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

    - #### getTextRaf

          public RandomAccessFile getTextRaf(Testament testament)

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

    - #### getOtTextRaf

          public RandomAccessFile getOtTextRaf()

      Returns:
        the otTextRaf

    - #### getNtTextRaf

          public RandomAccessFile getNtTextRaf()

      Returns:
        the ntTextRaf

    - #### getTextFile

          public File getTextFile(Testament testament)

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

    - #### getIdxFile

          public File getIdxFile(Testament testament)

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