org.crosswire.jsword.book.sword.state

## Class AbstractOpenFileState

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

- All Implemented Interfaces:
    Closeable, AutoCloseable, OpenFileState
  Direct Known Subclasses:
    GenBookBackendState, RawBackendState, RawLDBackendState, ZVerseBackendState

      public abstract class AbstractOpenFileState
      extends Object
      implements OpenFileState

  Author:
    DM Smith
  See Also:
    `The GNU Lesser General Public License for details.`

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private BookMetaData` | `bookMetaData` The BookMetaData for this OpenFileState.
    `private long` | `lastAccess` The time of last access, used for LRU expiration of state.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractOpenFileState(BookMetaData bmd)` Create an AbstractOpenFileState tied to a BookMetaData.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Allows us to decide whether to release the resources or continue using them
    `BookMetaData` | `getBookMetaData()` Get the BookMetaData for this OpenFileState.
    `long` | `getLastAccess()`
    `void` | `setLastAccess(long lastAccess)` Sets the last access time

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

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

    - ### Methods inherited from interface org.crosswire.jsword.book.sword.state.OpenFileState

      `releaseResources`

- - ### Field Detail

    - #### bookMetaData

          private BookMetaData bookMetaData

      The BookMetaData for this OpenFileState. Used to locate files.

    - #### lastAccess

          private long lastAccess

      The time of last access, used for LRU expiration of state.

  - ### Constructor Detail

    - #### AbstractOpenFileState

          public AbstractOpenFileState(BookMetaData bmd)

      Create an AbstractOpenFileState tied to a BookMetaData.
      Parameters:
        `bmd` - the BookMetaData for this OpenFileState

  - ### Method Detail

    - #### close

          public void close()

      Allows us to decide whether to release the resources or continue using them
      Specified by:
        `close` in interface `Closeable`
      Specified by:
        `close` in interface `AutoCloseable`

    - #### getBookMetaData

          public BookMetaData getBookMetaData()

      Get the BookMetaData for this OpenFileState.
      Specified by:
        `getBookMetaData` in interface `OpenFileState`
      Returns:
        the BookMetaData

    - #### getLastAccess

          public long getLastAccess()

      Specified by:
        `getLastAccess` in interface `OpenFileState`
      Returns:
        latest access before releasing back to the pool

    - #### setLastAccess

          public void setLastAccess(long lastAccess)

      Description copied from interface: `OpenFileState`
      Sets the last access time
      Specified by:
        `setLastAccess` in interface `OpenFileState`
      Parameters:
        `lastAccess` - last time the file state was accessed