org.crosswire.jsword.book.sword
Class ZLDBackend

java.lang.Object
  extended by org.crosswire.jsword.book.sword.AbstractBackend
      extended by org.crosswire.jsword.book.sword.AbstractKeyBackend
          extended by org.crosswire.jsword.book.sword.RawLDBackend
              extended by org.crosswire.jsword.book.sword.ZLDBackend
All Implemented Interfaces:
Serializable, Cloneable, Comparable, Activatable, Iterable, Key

public class ZLDBackend
extends RawLDBackend

An extension of RawLDBackend to read Z format files.

Author:
Joe Walker [joe at eireneh dot com], DM Smith [dmsmith555 at yahoo dot com]
See Also:
for license details. The copyright to this program is held by it's authors., Serialized Form

Field Summary
private  boolean active
          Flags whether there are open files or not
private static int BLOCK_ENTRY_COUNT
           
private static int BLOCK_ENTRY_SIZE
           
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 Logger log
          The log stream
private static long serialVersionUID
          Serialization ID
private  File zdtFile
          The compressed text.
private  RandomAccessFile zdtRaf
          The compressed text random access file.
private static int ZDX_ENTRY_SIZE
           
private  File zdxFile
          The compressed index.
private  RandomAccessFile zdxRaf
          The compressed index random access file.
 
Constructor Summary
ZLDBackend(SwordBookMetaData sbmd)
          Simple ctor
 
Method Summary
 void activate(Lock lock)
          Called to indicate that the Book should initialize itself, and consume whatever system resources it needs to be able to respond to other queries.
 void deactivate(Lock lock)
          Called to indicate that the Book should release whatever system resources it can to make way for other uses.
protected  String getRawText(DataEntry entry)
           
protected  boolean isActive()
          Determine whether we are active.
private  void readObject(ObjectInputStream is)
          Serialization support.
 
Methods inherited from class org.crosswire.jsword.book.sword.RawLDBackend
checkActive, get, getCardinality, getRawText, getRawText, indexOf
 
Methods inherited from class org.crosswire.jsword.book.sword.AbstractKeyBackend
addAll, blur, canHaveChildren, clear, clone, compareTo, contains, equals, getChildCount, getName, getName, getOsisID, getOsisRef, getParent, getRootName, hashCode, isEmpty, iterator, removeAll, retainAll
 
Methods inherited from class org.crosswire.jsword.book.sword.AbstractBackend
decipher, encipher, getBookMetaData, getExpandedDataPath, isSupported, isWritable, readIndex, setRawText
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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

ZDX_ENTRY_SIZE

private static final int ZDX_ENTRY_SIZE
See Also:
Constant Field Values

BLOCK_ENTRY_COUNT

private static final int BLOCK_ENTRY_COUNT
See Also:
Constant Field Values

BLOCK_ENTRY_SIZE

private static final int BLOCK_ENTRY_SIZE
See Also:
Constant Field Values

EMPTY_BYTES

private static final byte[] EMPTY_BYTES

active

private transient boolean active
Flags whether there are open files or not


zdxFile

private transient File zdxFile
The compressed index.


zdxRaf

private transient RandomAccessFile zdxRaf
The compressed index random access file.


zdtFile

private transient File zdtFile
The compressed text.


zdtRaf

private transient RandomAccessFile zdtRaf
The compressed text random access file.


lastBlockNum

private transient long lastBlockNum
The index of the block that is cached.


lastUncompressed

private transient byte[] lastUncompressed
The cache for a read of a compressed block.


serialVersionUID

private static final long serialVersionUID
Serialization ID

See Also:
Constant Field Values

log

private static final Logger log
The log stream

Constructor Detail

ZLDBackend

public ZLDBackend(SwordBookMetaData sbmd)
Simple ctor

Method Detail

getRawText

protected String getRawText(DataEntry entry)
Overrides:
getRawText in class RawLDBackend

activate

public void activate(Lock lock)
Description copied from interface: Activatable
Called to indicate that the Book should initialize itself, and consume whatever system resources it needs to be able to respond to other queries.

Specified by:
activate in interface Activatable
Overrides:
activate in class RawLDBackend
Parameters:
lock - An attempt to ensure that only the Activator calls this method

deactivate

public void deactivate(Lock lock)
Description copied from interface: Activatable
Called to indicate that the Book should release whatever system resources it can to make way for other uses.

Specified by:
deactivate in interface Activatable
Overrides:
deactivate in class RawLDBackend
Parameters:
lock - An attempt to ensure that only the Activator calls this method

isActive

protected boolean isActive()
Determine whether we are active.

Overrides:
isActive in class RawLDBackend

readObject

private void readObject(ObjectInputStream is)
                 throws IOException,
                        ClassNotFoundException
Serialization support.

Parameters:
is -
Throws:
IOException
ClassNotFoundException

Copyright ยจ 2003-2007