|
||||||||||
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.
for license details.
The copyright to this program is held by it's authors.
Field Summary | |
---|---|
private static Logger |
log
The log stream |
private static int |
ZBUF_SIZE
The size to read/write when unzipping a compressed byte array of unknown size. |
Constructor Summary | |
---|---|
private |
SwordUtil()
Prevent Instansiation |
Method Summary | |
---|---|
static void |
clean1252(Key key,
byte[] data)
Remove rogue characters in the source. |
static void |
clean1252(Key key,
byte[] data,
int length)
Remove rogue characters in the source. |
static String |
decode(Key key,
byte[] data,
int length,
String charset)
Transform a byte array into a string given the encoding. |
static String |
decode(Key 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 |
protected static int |
decodeLittleEndian32(byte[] data,
int offset)
Decode 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 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 |
static byte[] |
uncompress(byte[] compressed)
Uncompress a block of (G)ZIP compressed data, when the resulting size is not known. |
static byte[] |
uncompress(byte[] compressed,
int endsize)
Uncompress a block of (G)ZIP compressed data |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final Logger log
private static final int ZBUF_SIZE
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
protected static byte[] readNextRAF(RandomAccessFile raf, int theSize) throws IOException
raf
- The file to readtheSize
- The number of bytes to read
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
protected static byte[] readUntilRAF(RandomAccessFile raf, byte stopByte) throws IOException
raf
- The file to readstopByte
- The point at which to stop reading
IOException
protected static int decodeLittleEndian32(byte[] data, int offset)
data
- the byte[] from which to read 4 bytesoffset
- the offset into the array
protected static int decodeLittleEndian16(byte[] data, int offset)
data
- the byte[] from which to read 4 bytesoffset
- the offset into the array
protected static int findByte(byte[] data, byte sought)
data
- The array to searchsought
- The data to search for
public static byte[] uncompress(byte[] compressed, int endsize) throws DataFormatException, BookException
compressed
- The data to uncompressendsize
- The expected resultant data size
DataFormatException
BookException
public static byte[] uncompress(byte[] compressed) throws IOException
compressed
- The data to uncompress
IOException
public static String decode(Key key, byte[] data, String charset)
data
- The byte array to be convertedcharset
- The encoding of the byte array
public static String decode(Key key, byte[] data, int length, String charset)
data
- The byte array to be convertedcharset
- The encoding of the byte array
public static void clean1252(Key key, byte[] data)
public static void clean1252(Key key, byte[] data, int length)
|
Copyright ยจ 2003-2006 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |