Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.crosswire.jsword.book.sword
Class ZLDBackend

    java.lang.Object
      org.crosswire.jsword.book.sword.AbstractBackend
          org.crosswire.jsword.book.sword.ZLDBackend

All Implemented Interfaces:
  Activatable

    public class ZLDBackend

extends AbstractBackend

An implementation KeyBackend to read Z format files. LATER(joe): implement ZLDBackend

Author:
  Joe Walker [joe at eireneh dot com]
See Also:
  `for license details. The copyright to this program is held by it's authors.`

Nested Class Summary
`(package private) static class` | `ZLDBackend.IndexKey` A Key that knows where the data is in the real file.

Field Summary
`private boolean` | `active`
`private static int` | `BLOCK_ENTRY_COUNT`
`private static int` | `BLOCK_ENTRY_SIZE`
`private File` | `datFile`
`private RandomAccessFile` | `datRaf`
`private static byte[]` | `EMPTY_BYTES`
`private static String` | `EXTENSION_DATA`
`private static String` | `EXTENSION_INDEX`
`private static String` | `EXTENSION_Z_DATA`
`private static String` | `EXTENSION_Z_INDEX`
`private static int` | `IDX_ENTRY_SIZE`
`private File` | `idxFile`
`private RandomAccessFile` | `idxRaf`
`private Key` | `keys`
`private int` | `lastBlockNum`
`private byte[]` | `lastUncompressed`
`private static Logger` | `log` The log stream
`private static byte` | `SEPARATOR` Used to separate the key name from the key value
`private File` | `zdtFile` The compressed text.
`private RandomAccessFile` | `zdtRaf`
`private static int` | `ZDX_ENTRY_SIZE`
`private File` | `zdxFile` The compressed index.
`private RandomAccessFile` | `zdxRaf`

Constructor Summary
`ZLDBackend(SwordBookMetaData sbmd, File rootPath)` 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.
`protected void` | `checkActive()` Helper method so we can quickly activate ourselves on access
`void` | `deactivate(Lock lock)` Called to indicate that the Book should release whatever system resources it can to make way for other uses.
`String` | `getRawText(Key key)` Get the bytes alotted for the given verse
`boolean` | `isSupported()` Returns whether this AbstractBackend is implemented.
`Key` | `readIndex()` Initialise a AbstractBackend before use.

Methods inherited from class org.crosswire.jsword.book.sword.AbstractBackend
`decipher, getBookMetaData, getRootPath`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### EXTENSION_INDEX

    private static final String EXTENSION_INDEX

See Also:
  Constant Field Values

### EXTENSION_DATA

    private static final String EXTENSION_DATA

See Also:
  Constant Field Values

### 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

### IDX_ENTRY_SIZE

    private static final int IDX_ENTRY_SIZE

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

### SEPARATOR

    private static final byte SEPARATOR

  Used to separate the key name from the key value

  See Also:
    Constant Field Values

### log

    private static final Logger log

  The log stream

### idxFile

    private File idxFile

### datFile

    private File datFile

### zdxFile

    private File zdxFile

  The compressed index.

### zdtFile

    private File zdtFile

  The compressed text.

### idxRaf

    private RandomAccessFile idxRaf

### datRaf

    private RandomAccessFile datRaf

### zdxRaf

    private RandomAccessFile zdxRaf

### zdtRaf

    private RandomAccessFile zdtRaf

### active

    private boolean active

### keys

    private Key keys

### lastBlockNum

    private int lastBlockNum

### EMPTY_BYTES

    private static final byte[] EMPTY_BYTES

### lastUncompressed

    private byte[] lastUncompressed

Constructor Detail

### ZLDBackend

    public ZLDBackend(SwordBookMetaData sbmd,
                      File rootPath)
               throws BookException

  Simple ctor

  Throws:
    `BookException`

Method Detail

### activate

    public final 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.

  Parameters:
    `lock` - An attempt to ensure that only the Activator calls this method

### deactivate

    public final 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.

  Parameters:
    `lock` - An attempt to ensure that only the Activator calls this method

### readIndex

    public Key readIndex()

  Description copied from class: `AbstractBackend`
  Initialise a AbstractBackend before use. This method needs to call addKey() a number of times on SwordDictionary

  Specified by:
    `readIndex` in class `AbstractBackend`

### getRawText

    public String getRawText(Key key)
                      throws BookException

  Description copied from class: `AbstractBackend`
  Get the bytes alotted for the given verse

  Specified by:
    `getRawText` in class `AbstractBackend`
  Parameters:
    `key` - The key to fetch
  Returns:
    String The data for the verse in question
  Throws:
    `BookException` - If the data can not be read.

### isSupported

    public boolean isSupported()

  Description copied from class: `AbstractBackend`
  Returns whether this AbstractBackend is implemented.

  Specified by:
    `isSupported` in class `AbstractBackend`
  Returns:
    true if this AbstractBackend is implemented.

### checkActive

    protected final void checkActive()

  Helper method so we can quickly activate ourselves on access

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Copyright ¨ 2003-2006
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD