org.crosswire.jsword.book.sword.state

## Class RawFileBackendState

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

- All Implemented Interfaces:
    Closeable, AutoCloseable, OpenFileState

      public class RawFileBackendState
      extends RawBackendState

  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 File` | `incfile`
    `static String` | `INCFILE`
    `private int` | `incfileValue`
    `private static org.slf4j.Logger` | `LOGGER` The log stream

    - ### Fields inherited from class org.crosswire.jsword.book.sword.state.RawBackendState

      `ntIdxFile, ntIdxRaf, ntTextFile, ntTextRaf, otIdxFile, otIdxRaf, otTextFile, otTextRaf`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RawFileBackendState(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
    --- | ---
    `private boolean` | `existsAndCanReadAndWrite(File file)` Returns true if the file exists, can be read and can be written to.
    `File` | `getIncfile()`
    `int` | `getIncfileValue()`
    `private void` | `initIncFile()`
    `boolean` | `isWritable()`
    `private int` | `readIncfile()`
    `void` | `setIncfile(File incfile)`
    `void` | `setIncfileValue(int incValue)`

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

      `getIdxFile, getIdxRaf, getNtTextRaf, getOtTextRaf, getTextFile, getTextRaf, 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

    - #### INCFILE

          public static final String INCFILE

      See Also:
        Constant Field Values

    - #### incfile

          private File incfile

    - #### incfileValue

          private int incfileValue

    - #### LOGGER

          private static final org.slf4j.Logger LOGGER

      The log stream

  - ### Constructor Detail

    - #### RawFileBackendState

          RawFileBackendState(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()

      Overrides:
        `isWritable` in class `RawBackendState`

    - #### existsAndCanReadAndWrite

          private boolean existsAndCanReadAndWrite(File file)

      Returns true if the file exists, can be read and can be written to.
      Parameters:
        `file` - the file
      Returns:
        true, if successful

    - #### readIncfile

          private int readIncfile()
                           throws IOException

      Throws:
        `IOException`

    - #### initIncFile

          private void initIncFile()

    - #### getIncfileValue

          public int getIncfileValue()

      Returns:
        the incfileValue

    - #### setIncfileValue

          public void setIncfileValue(int incValue)

    - #### getIncfile

          public File getIncfile()

      Returns:
        the incfile

    - #### setIncfile

          public void setIncfile(File incfile)

      Parameters:
        `incfile` - the incfile to set