|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.crosswire.jsword.book.sword.AbstractBackend
org.crosswire.jsword.book.sword.AbstractKeyBackend
org.crosswire.jsword.book.sword.RawLDBackend
public class RawLDBackend
An implementation AbstractKeyBackend to read RAW format files.
for license details.
The copyright to this program is held by it's authors.
,
Serialized FormField Summary | |
---|---|
private boolean |
active
Flags whether there are open files or not |
private int |
datasize
The number of bytes in the size count in the index |
private static MessageFormat |
DATE_KEY_FORMAT
Date formatter |
private File |
datFile
The data file |
private RandomAccessFile |
datRaf
The data random access file |
private int |
entrysize
The number of bytes for each entry in the index: either 6 or 8 |
private File |
idxFile
The index file |
private RandomAccessFile |
idxRaf
The index random access file |
private static Logger |
log
The log stream |
private static int |
OFFSETSIZE
How many bytes in the offset pointers in the index |
private static long |
serialVersionUID
Serialization ID |
private int |
size
The number of entries in the book. |
private static Pattern |
STRONGS_PATTERN
This is the pattern of a Strong's Number. |
private static DecimalFormat |
ZERO_4PAD
|
private static DecimalFormat |
ZERO_5PAD
A means to normalize Strong's Numbers. |
Constructor Summary | |
---|---|
RawLDBackend(SwordBookMetaData sbmd,
int datasize)
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 boolean |
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. |
private String |
external2internal(String externalKey)
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). |
private DataEntry |
getEntry(String reply,
int index)
Get the text for an indexed entry in the book. |
private DataIndex |
getIndex(long entry)
Get the Index (that is offset and size) for an entry. |
protected String |
getRawText(DataEntry entry)
|
String |
getRawText(Key key)
Get the text allotted for the given entry |
String |
getRawText(String key)
|
int |
indexOf(Key that)
Reverse a Key into the position the key holds in the list of children |
private String |
internal2external(String internalKey)
|
protected boolean |
isActive()
Determine whether we are active. |
private String |
normalizeForSearch(String internalKey)
|
private void |
readObject(ObjectInputStream is)
Serialization support. |
private int |
search(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 |
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 |
---|
private static final int OFFSETSIZE
private transient boolean active
private int datasize
private int entrysize
private transient int size
private transient File idxFile
private transient RandomAccessFile idxRaf
private transient File datFile
private transient RandomAccessFile datRaf
private static final MessageFormat DATE_KEY_FORMAT
private static final Pattern STRONGS_PATTERN
private static final DecimalFormat ZERO_5PAD
private static final DecimalFormat ZERO_4PAD
private static final long serialVersionUID
private static final Logger log
Constructor Detail |
---|
public RawLDBackend(SwordBookMetaData sbmd, int datasize)
datasize
- We need to know how many bytes in the size portion of the indexMethod Detail |
---|
public String getRawText(Key key) throws BookException
AbstractBackend
getRawText
in class AbstractBackend
key
- The key to fetch
BookException
- If the data can not be read.public String getRawText(String key) throws BookException
BookException
protected String getRawText(DataEntry entry)
public int getCardinality()
Key
public Key get(int index)
Key
index
- The index of the Key to retrieve
public int indexOf(Key that)
Key
that
- The Key to find
public void activate(Lock lock)
Activatable
lock
- An attempt to ensure that only the Activator calls this methodpublic void deactivate(Lock lock)
Activatable
lock
- An attempt to ensure that only the Activator calls this methodprotected boolean checkActive()
protected boolean isActive()
private DataIndex getIndex(long entry) throws IOException
entry
-
IOException
private DataEntry getEntry(String reply, int index) throws IOException
index
- the entry to get
IOException
private int search(String key) throws IOException
key
-
IOException
private String external2internal(String externalKey)
externalKey
-
private String internal2external(String internalKey)
private String normalizeForSearch(String internalKey)
private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException
is
-
IOException
ClassNotFoundException
|
Copyright ยจ 2003-2007 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |