|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.crosswire.jsword.book.sword.SwordUtil
public final class SwordUtil
Various utilities used by different Sword classes.
The GNU Lesser General Public License for details.| Field Summary | |
|---|---|
private static org.slf4j.Logger |
log
The log stream |
| Constructor Summary | |
|---|---|
private |
SwordUtil()
Prevent instantiation |
| Method Summary | |
|---|---|
private static void |
clean1252(String key,
byte[] data,
int offset,
int length)
Remove rogue characters in the source. |
static String |
decode(String key,
byte[] data,
int offset,
int length,
String charset)
Transform a portion of a byte array starting at an offset into a string given the encoding. |
static String |
decode(String key,
byte[] data,
int length,
String charset)
Transform a portion of a byte array into a string given the encoding. |
static String |
decode(String key,
byte[] data,
String charset)
Transform a byte array into a string given the encoding. |
protected static int |
decodeLittleEndian16(byte[] data,
int offset)
Decode little endian data from a byte array |
static int |
decodeLittleEndian32(byte[] data,
int offset)
Decode little endian data from a byte array. |
protected static void |
encodeLittleEndian16(int val,
byte[] data,
int offset)
Encode a 16-bit little endian from an integer. |
protected static void |
encodeLittleEndian32(int val,
byte[] data,
int offset)
Encode little endian data from a byte array. |
protected static int |
findByte(byte[] data,
byte sought)
Find a byte of data in an array |
protected static int |
findByte(byte[] data,
int offset,
byte sought)
Find a byte of data in an array |
static URI |
getExpandedDataPath(SwordBookMetaData bookMetaData)
Returns where the book should be located |
protected static byte[] |
readNextRAF(RandomAccessFile raf,
int theSize)
Read a RandomAccessFile from the current location in the file. |
protected static byte[] |
readRAF(RandomAccessFile raf,
long offset,
int theSize)
Read a RandomAccessFile |
protected static byte[] |
readUntilRAF(RandomAccessFile raf,
byte stopByte)
Read a RandomAccessFile until a particular byte is seen |
protected static byte[] |
readUntilRAF(RandomAccessFile raf,
int offset,
byte stopByte)
Read a RandomAccessFile until a particular byte is seen |
protected static void |
writeNextRAF(RandomAccessFile raf,
byte[] data)
|
protected static void |
writeRAF(RandomAccessFile raf,
long offset,
byte[] data)
Writes "data" to a RandomAccessFile at the "offset" position |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final org.slf4j.Logger log
| Constructor Detail |
|---|
private SwordUtil()
| Method Detail |
|---|
protected static byte[] readRAF(RandomAccessFile raf,
long offset,
int theSize)
throws IOException
raf - The file to readoffset - The start of the record to readtheSize - The number of bytes to read
IOException - on error
protected static byte[] readNextRAF(RandomAccessFile raf,
int theSize)
throws IOException
raf - The file to readtheSize - The number of bytes to read
IOException - on error
protected static void writeRAF(RandomAccessFile raf,
long offset,
byte[] data)
throws IOException
raf - RandomAccessFileoffset - offset to write atdata - data to write
IOException - on error
protected static void writeNextRAF(RandomAccessFile raf,
byte[] data)
throws IOException
IOException
protected static byte[] readUntilRAF(RandomAccessFile raf,
int offset,
byte stopByte)
throws IOException
raf - The file to readoffset - The start of the record to readstopByte - The point at which to stop reading
IOException - on error
protected static byte[] readUntilRAF(RandomAccessFile raf,
byte stopByte)
throws IOException
raf - The file to readstopByte - The point at which to stop reading
IOException - on error
public static int decodeLittleEndian32(byte[] data,
int offset)
data - the byte[] from which to read 4 bytesoffset - the offset into the array
protected static void encodeLittleEndian32(int val,
byte[] data,
int offset)
val - the number to encode into little endiandata - the byte[] from which to write 4 bytesoffset - the offset into the array
protected static int decodeLittleEndian16(byte[] data,
int offset)
data - the byte[] from which to read 2 bytesoffset - the offset into the array
protected static void encodeLittleEndian16(int val,
byte[] data,
int offset)
data - the byte[] from which to write 2 bytesoffset - the offset into the array
protected static int findByte(byte[] data,
byte sought)
data - The array to searchsought - The data to search for
protected static int findByte(byte[] data,
int offset,
byte sought)
data - The array to searchoffset - The position in the array to begin lookingsought - The data to search for
public static String decode(String key,
byte[] data,
String charset)
key - the keydata - The byte array to be convertedcharset - The encoding of the byte array
public static String decode(String key,
byte[] data,
int length,
String charset)
key - the keydata - The byte array to be convertedlength - The number of bytes to use.charset - The encoding of the byte array
public static String decode(String key,
byte[] data,
int offset,
int length,
String charset)
key - the keydata - The byte array to be convertedoffset - The starting position in the byte arraylength - The number of bytes to use.charset - The encoding of the byte array
private static void clean1252(String key,
byte[] data,
int offset,
int length)
public static URI getExpandedDataPath(SwordBookMetaData bookMetaData)
throws BookException
bookMetaData - meta information about the book
BookException - thrown if an issue is encountered, e.g. missing data files.
|
Copyright ยจ 2003-2015 | |||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||