|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.devexperts.qd.util.ShortString
public class ShortString
Auxiliary class for converting short (up to 8 characters) strings into primitive long values and backwards. The conversion always skips zero characters in the input and never produces them in the output.
Method Summary | |
---|---|
static java.lang.String |
decode(long code)
Decodes long code into string. |
static long |
encode(byte[] data,
int offset,
int length)
|
static long |
encode(java.lang.String str)
Encodes string up to 8 characters as a long. |
static long |
encode(java.lang.String str,
int offset,
int length)
Encodes a portion of a string up to 8 character to long. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static long encode(java.lang.String str)
"A"
encodes as 0x41L
, "AB"
encodes as 0x4142L
, etc.
null
and ""
both encode as 0
.
str
- the string.
java.lang.IllegalArgumentException
- if length is greater than 8 or string contains character larger than 0xFFpublic static long encode(java.lang.String str, int offset, int length)
encode(str.substring(offset, offset + length))
.
str
- the string.offset
- the initial offset of the string.length
- the length of the substring to encode.
java.lang.NullPointerException
- if str
is null.
java.lang.IllegalArgumentException
- if length is greater than 8 or string contains character larger than 0xFFencode(String)
public static long encode(byte[] data, int offset, int length)
public static java.lang.String decode(long code)
0x0000000000000041L
,
0x0000004100000000L
, and 0x4100000000000000L
decode as "A"
.
0x4142L
decodes as "AB"
, etc.
0
decodes as null
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |