|
||||||||||
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 class SwordUtil
Various utilities used by different Sword classes.
Distribution Licence: JSword is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License, version 2 as published by the Free Software Foundation. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. The License is available on the internet here, or by writing to: Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA The copyright to this program is held by it's authors. |
Licence
Field Summary | |
---|---|
private static Logger |
log
The log stream |
Constructor Summary | |
---|---|
private |
SwordUtil()
Prevent Instansiation |
Method Summary | |
---|---|
static String |
clean(Key key,
String data)
Remove rogue characters in the source. |
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 long |
decodeLittleEndian32(byte[] data,
int offset)
Decode little endian data from a byte array |
protected static int |
decodeLittleEndian32AsInt(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[] |
readRAF(RandomAccessFile raf,
long offset,
int size)
Read a RandomAccessFile |
protected static int |
un2complement(byte data)
Un 2-s complement a byte |
static byte[] |
uncompress(byte[] compressed,
int endsize)
Uncompress a block of GZIP 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
Constructor Detail |
---|
private SwordUtil()
Method Detail |
---|
protected static byte[] readRAF(RandomAccessFile raf, long offset, int size) throws IOException
raf
- The file to readoffset
- The record to readsize
- The number of bytes to read
IOException
protected static long decodeLittleEndian32(byte[] data, int offset)
data
- the byte[] from which to read 4 bytesoffset
- the offset into the array
protected static int decodeLittleEndian32AsInt(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 un2complement(byte data)
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 String decode(Key key, byte[] data, String charset)
data
- The byte array to be convertedcharset
- The encoding of the byte array
public static String clean(Key key, String data)
|
Copyright ? 2003-2004 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |