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 RawLDBackend<T extends RawLDBackendState>

    java.lang.Object
      org.crosswire.jsword.book.sword.AbstractBackend<T>
          org.crosswire.jsword.book.sword.AbstractKeyBackend<RawLDBackendState>
              org.crosswire.jsword.book.sword.RawLDBackend<T>

Type Parameters:
  `T` - The type of the RawLDBackendState that this class extends.

All Implemented Interfaces:
  Serializable, Cloneable, Comparable<Key>, Iterable<Key>, Backend<RawLDBackendState>, StatefulFileBackedBackend<RawLDBackendState>, Key

Direct Known Subclasses:
  ZLDBackend

    public class RawLDBackend<T extends RawLDBackendState>

extends AbstractKeyBackend<RawLDBackendState>

An implementation AbstractKeyBackend to read RAW format files.

Author:
  Joe Walker, DM Smith
See Also:
  `The GNU Lesser General Public License for details.`, Serialized Form

Field Summary
`private int` | `datasize` The number of bytes in the size count in the index
`private static MessageFormat` | `DATE_KEY_FORMAT` Date formatter
`private int` | `entrysize` The number of bytes for each entry in the index: either 6 or 8
`private static int` | `OFFSETSIZE` How many bytes in the offset pointers in the index
`private static long` | `serialVersionUID` Serialization ID
`private static Pattern` | `STRONGS_PATTERN` This is the pattern of a Strong's Number.

Constructor Summary
`RawLDBackend(SwordBookMetaData sbmd, int datasize)` Simple ctor

Method Summary
`private String` | `external2internal(String externalKey, String pattern)` Convert the supplied key to something that can be understood by the module.
`Key` | `get(int index)` Gets a key from a specific point in this list of children.
`int` | `getCardinality()` Returns the number of elements in this set (its cardinality).
`protected DataEntry` | `getEntry(RawLDBackendState state, DataEntry entry)` Get the entry indicated by this entry.
`private DataEntry` | `getEntry(RawLDBackendState state, String reply, int index)` Get the text for an indexed entry in the book.
`private DataIndex` | `getIndex(RawLDBackendState state, long entry)` Get the Index (that is offset and size) for an entry.
`protected String` | `getRawText(DataEntry entry)`
`int` | `getRawTextLength(Key key)` Determine the size of the raw data for the key in question.
`private DecimalFormat` | `getZero4Pad()` A means to normalize Strong's Numbers.
`private DecimalFormat` | `getZero5Pad()` A means to normalize Strong's Numbers.
`int` | `indexOf(Key that)` Reverse a Key into the position the key holds in the list of children
`RawLDBackendState` | `initState()` Initialises the state required to read from files, specific to each different backend
`private String` | `internal2external(String internalKey)`
`private String` | `normalizeForSearch(String internalKey)`
`private void` | `readObject(ObjectInputStream is)` Serialization support.
`String` | `readRawContent(RawLDBackendState state, Key key)`
`private String` | `readRawContent(RawLDBackendState state, String key)`
`private int` | `search(RawLDBackendState state, String key)` Find a matching entry, returning it's index.

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, setAliasKey, setRawText`

Methods inherited from class org.crosswire.jsword.book.sword.AbstractBackend
`create, decipher, encipher, getBookMetaData, getGlobalKeyList, getRawText, isSupported, isWritable, readIndex, readToOsis, setAliasKey`

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

Field Detail

### DATE_KEY_FORMAT

    private static final MessageFormat DATE_KEY_FORMAT

  Date formatter

### STRONGS_PATTERN

    private static final Pattern STRONGS_PATTERN

  This is the pattern of a Strong's Number. It begins with a G or H. Is followed by a number. It can be followed by a ! and a letter or just a letter.

### datasize

    private final int datasize

  The number of bytes in the size count in the index

### entrysize

    private final int entrysize

  The number of bytes for each entry in the index: either 6 or 8

### OFFSETSIZE

    private static final int OFFSETSIZE

  How many bytes in the offset pointers in the index

  See Also:
    Constant Field Values

### serialVersionUID

    private static final long serialVersionUID

  Serialization ID

  See Also:
    Constant Field Values

Constructor Detail

### RawLDBackend

    public RawLDBackend(SwordBookMetaData sbmd,
                        int datasize)

  Simple ctor

  Parameters:
    `sbmd` -
    `datasize` - We need to know how many bytes in the size portion of the index

Method Detail

### readRawContent

    public String readRawContent(RawLDBackendState state,
                                 Key key)
                          throws IOException

  Parameters:
    `state` - the state object containing all the open random access files
    `key` - the verse that is sought
  Returns:
    the raw text
  Throws:
    `IOException` - something went wrong when reading the verse

### initState

    public RawLDBackendState initState()
                                throws BookException

  Description copied from interface: `StatefulFileBackedBackend`
  Initialises the state required to read from files, specific to each different backend

  Returns:
    the state that has been initialised
  Throws:
    `BookException`

### readRawContent

    private String readRawContent(RawLDBackendState state,
                                  String key)
                           throws IOException

  Throws:
    `IOException`

### getRawText

    protected String getRawText(DataEntry entry)

### getCardinality

    public int getCardinality()

  Description copied from interface: `Key`
  Returns the number of elements in this set (its cardinality). If this set contains more than `Integer.MAX_VALUE` elements, returns `Integer.MAX_VALUE`.

  This method is potentially expensive, as it often requires cycling through all the keys in the set.

  Returns:
    the number of elements in this set (its cardinality).

### get

    public Key get(int index)

  Description copied from interface: `Key`
  Gets a key from a specific point in this list of children.

  Parameters:
    `index` - The index of the Key to retrieve
  Returns:
    The specified key

### indexOf

    public int indexOf(Key that)

  Description copied from interface: `Key`
  Reverse a Key into the position the key holds in the list of children

  Parameters:
    `that` - The Key to find
  Returns:
    The index of the key or < 0 if the key is not in the list

### getRawTextLength

    public int getRawTextLength(Key key)

  Description copied from interface: `Backend`
  Determine the size of the raw data for the key in question. This method may not be faster than getting the raw text and getting its size.

  Specified by:
    `getRawTextLength` in interface `Backend<RawLDBackendState>`
  Overrides:
    `getRawTextLength` in class `AbstractBackend<RawLDBackendState>`
  Parameters:
    `key` - The key whose raw data length is desired.
  Returns:
    The length of the raw data, 0 if not a valid key.

### getIndex

    private DataIndex getIndex(RawLDBackendState state,
                               long entry)
                        throws IOException

  Get the Index (that is offset and size) for an entry.

  Parameters:
    `entry` -
  Returns:
    the index of the entry
  Throws:
    `IOException`

### getEntry

    private DataEntry getEntry(RawLDBackendState state,
                               String reply,
                               int index)
                        throws IOException

  Get the text for an indexed entry in the book.

  Parameters:
    `index` - the entry to get
  Returns:
    the text for the entry.
  Throws:
    `IOException`

### getEntry

    protected DataEntry getEntry(RawLDBackendState state,
                                 DataEntry entry)

  Get the entry indicated by this entry. If this entry doesn't indicate any other entry then it returns the entry. Note, this is used by compressed dictionaries to get the deeper stuff.

  Parameters:
    `state` - the state where the entry can be found
    `entry` - the entry that might indicate a deeper entry
  Returns:
    the final entry

### search

    private int search(RawLDBackendState state,
                       String key)
                throws IOException

  Find a matching entry, returning it's index. Otherwise return < 0, such that (-pos - 1) gives the insertion index.

  Parameters:
    `key` -
  Returns:
    the match
  Throws:
    `IOException`

### external2internal

    private String external2internal(String externalKey,
                                     String pattern)

  Convert the supplied key to something that can be understood by the module. Use firstKey to determine the pattern for Strong's numbers.

  Parameters:
    `externalKey` - The external key to normalize
    `pattern` - The first non-introduction key in the module.
  Returns:
    the internal representation of the key.

### internal2external

    private String internal2external(String internalKey)

### normalizeForSearch

    private String normalizeForSearch(String internalKey)

### getZero5Pad

    private DecimalFormat getZero5Pad()

  A means to normalize Strong's Numbers.

### getZero4Pad

    private DecimalFormat getZero4Pad()

  A means to normalize Strong's Numbers.

### readObject

    private void readObject(ObjectInputStream is)
                     throws IOException,
                            ClassNotFoundException

  Serialization support.

  Parameters:
    `is` -
  Throws:
    `IOException`
    `ClassNotFoundException`

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