T
- The type of the RawLDBackendState that this class extends.public class RawLDBackend<T extends RawLDBackendState> extends AbstractKeyBackend<RawLDBackendState>
The GNU Lesser General Public License for details.
,
Serialized FormModifier and Type | Field and Description |
---|---|
private int |
datasize
The number of bytes in the size count in the index
|
private static MessageFormat |
DATE_KEY_FORMAT
Date formatter
|
private static Pattern |
DEVOTION_PATTERN
This is the pattern of a date for a DailyDevotion, DD.MM
|
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 and Description |
---|
RawLDBackend(SwordBookMetaData sbmd,
int datasize)
Simple ctor
|
Modifier and Type | Method and Description |
---|---|
private String |
doReadRawContent(RawLDBackendState state,
String key) |
void |
dumpIdxRaf()
Experimental code.
|
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,
DataIndex dataIndex)
Get the text for an indexed entry in the book.
|
protected 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 int |
search(RawLDBackendState state,
String key)
Find a matching entry, returning it's index.
|
void |
toIMP()
Experimental code.
|
addAll, blur, canHaveChildren, clear, clone, compareTo, contains, equals, getChildCount, getName, getName, getOsisID, getOsisRef, getParent, getRootName, hashCode, isEmpty, iterator, removeAll, retainAll, setAliasKey, setRawText
create, decipher, encipher, getBookMetaData, getGlobalKeyList, getRawText, isSupported, isWritable, readIndex, readToOsis, setAliasKey
private static final MessageFormat DATE_KEY_FORMAT
private static final Pattern STRONGS_PATTERN
private static final Pattern DEVOTION_PATTERN
private final int datasize
private final int entrysize
private static final int OFFSETSIZE
private static final long serialVersionUID
public RawLDBackend(SwordBookMetaData sbmd, int datasize)
sbmd
- datasize
- We need to know how many bytes in the size portion of the
indexpublic String readRawContent(RawLDBackendState state, Key key) throws IOException
state
- the state object containing all the open random access fileskey
- the verse that is soughtIOException
- something went wrong when reading the versepublic RawLDBackendState initState() throws BookException
StatefulFileBackedBackend
BookException
private String doReadRawContent(RawLDBackendState state, String key) throws IOException
IOException
public int getCardinality()
Key
This method is potentially expensive, as it often requires cycling through all the keys in the set.
public Key get(int index)
Key
index
- The index of the Key to retrievepublic int indexOf(Key that)
Key
that
- The Key to findpublic int getRawTextLength(Key key)
Backend
getRawTextLength
in interface Backend<RawLDBackendState>
getRawTextLength
in class AbstractBackend<RawLDBackendState>
key
- The key whose raw data length is desired.protected DataIndex getIndex(RawLDBackendState state, long entry) throws IOException
entry
- IOException
private DataEntry getEntry(RawLDBackendState state, String reply, DataIndex dataIndex) throws IOException
state
- the state object for the storagereply
- the context for this dataIndex, used for debuggingdataIndex
- the entry to getIOException
protected DataEntry getEntry(RawLDBackendState state, DataEntry entry)
state
- the state where the entry can be foundentry
- the entry that might indicate a deeper entryprivate int search(RawLDBackendState state, String key) throws IOException
key
- IOException
private String external2internal(String externalKey, String pattern)
externalKey
- The external key to normalizepattern
- The first non-introduction key in the module.private DecimalFormat getZero5Pad()
private DecimalFormat getZero4Pad()
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
is
- IOException
ClassNotFoundException
public void dumpIdxRaf()
public void toIMP()