org.crosswire.jsword.book.sword.state
Class ZLDBackendState

java.lang.Object
  extended by org.crosswire.jsword.book.sword.state.AbstractOpenFileState
      extended by org.crosswire.jsword.book.sword.state.RawLDBackendState
          extended by org.crosswire.jsword.book.sword.state.ZLDBackendState
All Implemented Interfaces:
Closeable, 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:
for license details.
The copyright to this program is held by it's authors.

Field Summary
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 log
          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
ZLDBackendState(SwordBookMetaData bookMetaData)
          This is default package access for forcing the use of the OpenFileStateManager to manage the creation.
 
Method Summary
 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
getBookMetaData, getDatRaf, getIdxFile, getIdxRaf, getSize, setSize
 
Methods inherited from class org.crosswire.jsword.book.sword.state.AbstractOpenFileState
close
 
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.


log

private static final org.slf4j.Logger log
The log stream

Constructor Detail

ZLDBackendState

ZLDBackendState(SwordBookMetaData 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

Copyright ? 2003-2011