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

java.lang.Object
  extended by org.crosswire.jsword.book.sword.state.AbstractOpenFileState
      extended by org.crosswire.jsword.book.sword.state.ZVerseBackendState
All Implemented Interfaces:
Closeable, OpenFileState

public class ZVerseBackendState
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:
for license details.
The copyright to this program is held by it's authors.

Field Summary
private  SwordBookMetaData bookMetaData
           
private  long lastBlockNum
           
private  Testament lastTestament
           
private  byte[] lastUncompressed
           
private static org.slf4j.Logger log
          The log stream
private  RandomAccessFile ntCompRaf
           
private  RandomAccessFile ntIdxRaf
           
private  RandomAccessFile ntTextRaf
           
private  RandomAccessFile otCompRaf
          The compressed random access files
private  RandomAccessFile otIdxRaf
          The index random access files
private  RandomAccessFile otTextRaf
          The data random access files
private static String SUFFIX_COMP
           
private static String SUFFIX_INDEX
           
private static String SUFFIX_PART1
           
private static String SUFFIX_TEXT
           
 
Constructor Summary
ZVerseBackendState(SwordBookMetaData bookMetaData, BlockType blockType)
          This is default package access for forcing the use of the OpenFileStateManager to manage the creation.
 
Method Summary
 SwordBookMetaData getBookMetaData()
           
 long getLastBlockNum()
           
 Testament getLastTestament()
           
 byte[] getLastUncompressed()
           
 RandomAccessFile getNtCompRaf()
           
 RandomAccessFile getNtIdxRaf()
           
 RandomAccessFile getNtTextRaf()
           
 RandomAccessFile getOtCompRaf()
           
 RandomAccessFile getOtIdxRaf()
           
 RandomAccessFile getOtTextRaf()
           
 void releaseResources()
           
 void setLastBlockNum(long lastBlockNum)
           
 void setLastTestament(Testament lastTestament)
           
 void setLastUncompressed(byte[] lastUncompressed)
           
 
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

SUFFIX_COMP

private static final String SUFFIX_COMP
See Also:
Constant Field Values

SUFFIX_INDEX

private static final String SUFFIX_INDEX
See Also:
Constant Field Values

SUFFIX_PART1

private static final String SUFFIX_PART1
See Also:
Constant Field Values

SUFFIX_TEXT

private static final String SUFFIX_TEXT
See Also:
Constant Field Values

otIdxRaf

private RandomAccessFile otIdxRaf
The index random access files


ntIdxRaf

private RandomAccessFile ntIdxRaf

otTextRaf

private RandomAccessFile otTextRaf
The data random access files


ntTextRaf

private RandomAccessFile ntTextRaf

otCompRaf

private RandomAccessFile otCompRaf
The compressed random access files


ntCompRaf

private RandomAccessFile ntCompRaf

lastTestament

private Testament lastTestament

lastBlockNum

private long lastBlockNum

lastUncompressed

private byte[] lastUncompressed

bookMetaData

private SwordBookMetaData bookMetaData

log

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

Constructor Detail

ZVerseBackendState

ZVerseBackendState(SwordBookMetaData bookMetaData,
                   BlockType blockType)
             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()

getOtIdxRaf

public RandomAccessFile getOtIdxRaf()
Returns:
the otIdxRaf

getNtIdxRaf

public RandomAccessFile getNtIdxRaf()
Returns:
the ntIdxRaf

getOtTextRaf

public RandomAccessFile getOtTextRaf()
Returns:
the otTextRaf

getNtTextRaf

public RandomAccessFile getNtTextRaf()
Returns:
the ntTextRaf

getOtCompRaf

public RandomAccessFile getOtCompRaf()
Returns:
the otCompRaf

getNtCompRaf

public RandomAccessFile getNtCompRaf()
Returns:
the ntCompRaf

getLastTestament

public Testament getLastTestament()
Returns:
the lastTestament

getLastBlockNum

public long getLastBlockNum()
Returns:
the lastBlockNum

getLastUncompressed

public byte[] getLastUncompressed()
Returns:
the lastUncompressed

setLastTestament

public void setLastTestament(Testament lastTestament)
Parameters:
lastTestament - the lastTestament to set

setLastBlockNum

public void setLastBlockNum(long lastBlockNum)
Parameters:
lastBlockNum - the lastBlockNum to set

setLastUncompressed

public void setLastUncompressed(byte[] lastUncompressed)
Parameters:
lastUncompressed - the lastUncompressed to set

getBookMetaData

public SwordBookMetaData getBookMetaData()
Returns:
the bookMetaData

Copyright ? 2003-2011