|
||||||||||
| 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.RawBackend
public class RawBackend
Both Books and Commentaries seem to use the same format so this class abstracts out the similarities.
for license details.
The copyright to this program is held by it's authors.| Field Summary | |
|---|---|
protected boolean |
active
Are we active |
protected int |
datasize
How many bytes in the size count in the index |
protected int |
entrysize
The number of bytes for each entry in the index: either 6 or 8 |
private static Logger |
log
The log stream |
protected File |
ntIdxFile
|
protected RandomAccessFile |
ntIdxRaf
|
protected File |
ntTxtFile
|
protected RandomAccessFile |
ntTxtRaf
|
protected static int |
OFFSETSIZE
How many bytes in the offset pointers in the index |
protected File |
otIdxFile
|
protected RandomAccessFile |
otIdxRaf
|
protected File |
otTxtFile
|
protected RandomAccessFile |
otTxtRaf
|
| Constructor Summary | |
|---|---|
RawBackend(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 void |
checkActive()
Helper method so we can quickly activate ourselves on access |
boolean |
contains(Key key)
Determine whether this Book contains the key in question |
void |
deactivate(Lock lock)
Called to indicate that the Book should release whatever system resources it can to make way for other uses. |
protected String |
getEntry(String name,
Testament testament,
long index)
Get the text for an indexed entry in the book. |
protected DataIndex |
getIndex(RandomAccessFile raf,
long entry)
Get the Index (that is offset and size) for an entry. |
String |
getRawText(Key key)
Get the text allotted for the given entry |
boolean |
isWritable()
A Backend is writable if the file system allows the underlying files to be opened for writing and if the backend has implemented writing. |
void |
setAliasKey(Key alias,
Key source)
Sets alias for a comment on a verse range I.e. |
void |
setRawText(Key key,
String text)
Set the text allotted for the given verse |
| Methods inherited from class org.crosswire.jsword.book.sword.AbstractBackend |
|---|
create, decipher, encipher, getBookMetaData, getExpandedDataPath, isSupported, readIndex |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected boolean active
protected int datasize
protected int entrysize
protected RandomAccessFile otIdxRaf
protected RandomAccessFile otTxtRaf
protected File otIdxFile
protected File otTxtFile
protected RandomAccessFile ntIdxRaf
protected RandomAccessFile ntTxtRaf
protected File ntIdxFile
protected File ntTxtFile
protected static final int OFFSETSIZE
private static final Logger log
| Constructor Detail |
|---|
public RawBackend(SwordBookMetaData sbmd,
int datasize)
| Method Detail |
|---|
public boolean contains(Key key)
AbstractBackend
contains in class AbstractBackendkey - The key whose presence is desired.
public String getRawText(Key key)
throws BookException
AbstractBackend
getRawText in class AbstractBackendkey - The key to fetch
BookException - If the data can not be read.
public void setRawText(Key key,
String text)
throws BookException,
IOException
AbstractBackend
setRawText in class AbstractBackendkey - The key to set text totext - The text to be set for key
BookException - If the data can not be set.
IOException - If the module data path could not be created.public boolean isWritable()
AbstractBackend
isWritable in class AbstractBackend
public void setAliasKey(Key alias,
Key source)
throws IOException
AbstractBackend
setAliasKey in class AbstractBackendalias - Alias Keysource - Source Key
IOException - Exception when anything goes wrong on writing the aliaspublic final void activate(Lock lock)
Activatable
lock - An attempt to ensure that only the Activator calls this methodpublic final void deactivate(Lock lock)
Activatable
lock - An attempt to ensure that only the Activator calls this methodprotected final void checkActive()
protected DataIndex getIndex(RandomAccessFile raf,
long entry)
throws IOException
entry -
IOException
protected String getEntry(String name,
Testament testament,
long index)
throws IOException
index - the entry to getname - name of the entrytestament - the testament for the entry
IOException - on a IO problem
|
Copyright ? 2003-2011 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||