|
||||||||||
| 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
org.crosswire.jsword.book.sword.RawFileBackend
public class RawFileBackend
A Raw File format that allows for each verse to have it's own storage. The basic structure of the index is as follows:
for license details.
The copyright to this program is held by it's authors.| Field Summary | |
|---|---|
private File |
incfile
|
private static String |
INCFILE
|
private int |
incfileValue
|
private static Logger |
log
|
| Fields inherited from class org.crosswire.jsword.book.sword.RawBackend |
|---|
active, datasize, entrysize, ntIdxFile, ntIdxRaf, ntTxtFile, ntTxtRaf, OFFSETSIZE, otIdxFile, otIdxRaf, otTxtFile, otTxtRaf |
| Constructor Summary | |
|---|---|
RawFileBackend(SwordBookMetaData sbmd,
int datasize)
|
|
| Method Summary | |
|---|---|
private void |
checkAndIncrementIncfile(int index)
|
void |
create()
Create the directory to hold the Book if it does not exist. |
private void |
createDataFiles()
|
private File |
createDataTextFile(int index)
|
private void |
createIncfile()
|
private void |
createIndexFiles()
|
private File |
getDataTextFile(RandomAccessFile txtRaf,
DataIndex dataIndex)
Gets the File having the verse text. |
protected String |
getEntry(String name,
Testament testament,
long index)
Get the text for an indexed entry in the book. |
String |
getRawText(Key key)
Get the text allotted for the given entry |
private String |
getTextFilename(RandomAccessFile txtRaf,
DataIndex dataIndex)
Gets the Filename for the File having the verse text. |
private void |
initIncFile()
|
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. |
private byte[] |
littleEndian16BitByteArrayFromShort(short val)
|
private byte[] |
littleEndian32BitByteArrayFromInt(int val)
|
private void |
prepopulateIncfile()
|
private void |
prepopulateIndexFiles()
|
private int |
readIncfile()
|
private byte[] |
readTextDataFile(File dataFile)
|
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 |
protected void |
updateDataFile(long ordinal,
File txtFile)
|
protected void |
updateIndexFile(RandomAccessFile idxRaf,
long index,
long dataFileStartPosition)
|
private void |
writeIncfile(int value)
|
private void |
writeInitialIndex(BufferedOutputStream outStream)
|
private void |
writeTextDataFile(File dataFile,
byte[] textData)
|
| Methods inherited from class org.crosswire.jsword.book.sword.RawBackend |
|---|
activate, checkActive, contains, deactivate, getIndex |
| Methods inherited from class org.crosswire.jsword.book.sword.AbstractBackend |
|---|
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 |
|---|
private static final String INCFILE
private File incfile
private int incfileValue
private static final Logger log
| Constructor Detail |
|---|
public RawFileBackend(SwordBookMetaData sbmd,
int datasize)
| Method Detail |
|---|
public String getRawText(Key key)
throws BookException
AbstractBackend
getRawText in class RawBackendkey - The key to fetch
BookException - If the data can not be read.
protected String getEntry(String name,
Testament testament,
long index)
throws IOException
RawBackend
getEntry in class RawBackendname - name of the entrytestament - the testament for the entryindex - the entry to get
IOException - on a IO problem
public void setRawText(Key key,
String text)
throws BookException,
IOException
AbstractBackend
setRawText in class RawBackendkey - 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 void setAliasKey(Key alias,
Key source)
throws IOException
AbstractBackend
setAliasKey in class RawBackendalias - Alias Keysource - Source Key
IOException - Exception when anything goes wrong on writing the aliasprivate void initIncFile()
private File createDataTextFile(int index)
throws BookException,
IOException
BookException
IOException
private String getTextFilename(RandomAccessFile txtRaf,
DataIndex dataIndex)
throws IOException
txtRaf - The random access file containing the file names for the verse storage.dataIndex - The index of where to get the data
IOException
private File getDataTextFile(RandomAccessFile txtRaf,
DataIndex dataIndex)
throws IOException,
BookException
txtRaf - The random access file containing the file names for the verse storage.dataIndex - The index of where to get the data
IOException
BookException
protected void updateIndexFile(RandomAccessFile idxRaf,
long index,
long dataFileStartPosition)
throws IOException
IOException
protected void updateDataFile(long ordinal,
File txtFile)
throws IOException
IOException
private void checkAndIncrementIncfile(int index)
throws IOException
IOException
public void create()
throws IOException,
BookException
AbstractBackend
create in class AbstractBackendIOException
BookExceptionpublic boolean isWritable()
AbstractBackend
isWritable in class RawBackend
private void createDataFiles()
throws IOException,
BookException
IOException
BookException
private void createIndexFiles()
throws IOException,
BookException
IOException
BookException
private void prepopulateIndexFiles()
throws IOException
IOException
private void createIncfile()
throws IOException,
BookException
IOException
BookException
private void prepopulateIncfile()
throws IOException
IOException
private void writeIncfile(int value)
throws IOException
IOException
private int readIncfile()
throws IOException
IOException
private void writeInitialIndex(BufferedOutputStream outStream)
throws IOException
IOException
private byte[] readTextDataFile(File dataFile)
throws IOException
IOException
private void writeTextDataFile(File dataFile,
byte[] textData)
throws IOException
IOExceptionprivate byte[] littleEndian32BitByteArrayFromInt(int val)
private byte[] littleEndian16BitByteArrayFromShort(short val)
|
Copyright ? 2003-2011 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||