public class GenBookBackend extends AbstractBackend<GenBookBackendState>
The GNU Lesser General Public License for details.| Modifier and Type | Field and Description |
|---|---|
private TreeKeyIndex |
index
The raw index file
|
private static org.slf4j.Logger |
log
The log stream
|
| Constructor and Description |
|---|
GenBookBackend(SwordBookMetaData sbmd)
Simple ctor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
contains(Key key)
Determine whether this Book contains the key in question
|
private void |
doReadIndex(TreeNode parentNode,
Key parentKey)
A helper function to recursively read the entire tree.
|
private TreeNode |
find(Key key)
Given a Key, find the TreeNode for it.
|
int |
getRawTextLength(Key key)
Determine the size of the raw data for the key in question.
|
GenBookBackendState |
initState()
Initialises the state required to read from files, specific to each
different backend
|
Key |
readIndex()
Initialize a AbstractBackend before use.
|
String |
readRawContent(GenBookBackendState state,
Key key) |
void |
setAliasKey(GenBookBackendState state,
Key alias,
Key source)
Sets alias for a comment on a verse range I.e.
|
void |
setRawText(GenBookBackendState rafBook,
Key key,
String text)
Set the text allotted for the given verse
|
create, decipher, encipher, getBookMetaData, getGlobalKeyList, getRawText, isSupported, isWritable, readToOsis, setAliasKeyprivate final TreeKeyIndex index
private static final org.slf4j.Logger log
public GenBookBackend(SwordBookMetaData sbmd)
sbmd - public GenBookBackendState initState() throws BookException
StatefulFileBackedBackendBookExceptionpublic boolean contains(Key key)
Backendcontains in interface Backend<GenBookBackendState>contains in class AbstractBackend<GenBookBackendState>key - The key whose presence is desired.public int getRawTextLength(Key key)
BackendgetRawTextLength in interface Backend<GenBookBackendState>getRawTextLength in class AbstractBackend<GenBookBackendState>key - The key whose raw data length is desired.public String readRawContent(GenBookBackendState state, Key key) throws IOException, BookException
state - the state object containing all the open random access fileskey - the verse that is soughtIOException - something went wrong when reading the verseBookExceptionprivate TreeNode find(Key key) throws IOException
key - The key to use for searchingIOExceptionpublic Key readIndex()
BackendreadIndex in interface Backend<GenBookBackendState>readIndex in class AbstractBackend<GenBookBackendState>public void setAliasKey(GenBookBackendState state, Key alias, Key source) throws IOException
StatefulFileBackedBackendstate - the open file statealias - Alias Keysource - Source KeyIOException - Exception when anything goes wrong on writing the aliaspublic void setRawText(GenBookBackendState rafBook, Key key, String text) throws BookException, IOException
StatefulFileBackedBackendrafBook - TODOkey - The key to set text totext - The text to be set for keyBookException - If the data can not be set.IOException - If the module data path could not be created.private void doReadIndex(TreeNode parentNode, Key parentKey) throws IOException
parentNode - the current node whose children are being soughtparentKey - IOException