|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object SQLite.StringEncoder
String encoder/decoder for SQLite. This module was kindly donated by Eric van der Maarel of Nedap N.V. This encoder was implemented based on an original idea from an anonymous author in the source code of the SQLite distribution. I feel obliged to provide a quote from the original C-source code: "The author disclaims copyright to this source code. In place of a legal notice, here is a blessing: May you do good and not evil. May you find forgiveness for yourself and forgive others. May you share freely, never taking more than you give."
Field Summary | |
(package private) static char[] |
xdigits
|
Constructor Summary | |
StringEncoder()
|
Method Summary | |
private static byte[] |
byteCopy(byte[] source,
int offset,
int count,
byte[] target)
Copies count elements from source, starting at element with index offset, to the given target. |
static byte[] |
decode(String s)
Decodes the given string that is assumed to be a valid encoding of a byte array. |
static String |
encode(byte[] a)
Encodes the given byte array into a string that can be used by the SQLite database. |
static String |
encodeX(byte[] a)
Encodes the given byte array into SQLite3 blob notation, ie X'..' |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
static final char[] xdigits
Constructor Detail |
public StringEncoder()
Method Detail |
private static byte[] byteCopy(byte[] source, int offset, int count, byte[] target)
source
- the source.offset
- the offset.count
- the number of elements to be copied.target
- the target to be returned.
public static byte[] decode(String s)
encode
method.
s
- the given string encoding.
IllegalArgumentException
- when the string given is not
a valid encoded string for this encoder.public static String encode(byte[] a)
a
- the byte array to be encoded. A null reference is handled as
an empty array.
decode
method
a string of size 1 will return an empty byte array.public static String encodeX(byte[] a)
a
- the byte array to be encoded. A null reference is handled as
an empty array.
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |