|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.tivoli.twg.libs.CompUnicodeString
A class for converting strings encoded using the NetFinity-style compressed unicode format to and from straight unicode Java Strings. NetFinity-style compressed unicode format is a 7 bits-per-byte format, with the high bit (bit 7) set to indicate that the next byte provides additional data bits, or clear if all higher bits are zero. This causes the following mapping:
0u0001 - 0u007F <-> one byte coding [ 0 (b06) (b05) (b04) (b01) (b00) (b03) (b02) ] 0u0080 - 0u3FFF <-> two byte coding, with bit 7 of byte 1 set [ 1 (b06) (b05) (b04) (b01) (b00) (b03) (b02) ] [ 0 (b13) (b12) (b11) (b08) (b07) (b10) (b09) ] 0u4000 - 0uFFFF <-> three byte coding, with bit 7 of byte 1 and 2 set [ 1 (b06) (b05) (b04) (b01) (b00) (b03) (b02) ] [ 1 (b13) (b12) (b11) (b08) (b07) (b10) (b09) ] [ 0 0 0 0 (b15) (b14) 0 0 ]
Also, bit 0 is exchanged with bit 2, and bit 1 is exchanged with bit 3 in each of the encoded bytes.
Field Summary | |
---|---|
static long |
serialVersionUID
|
Constructor Summary | |
---|---|
CompUnicodeString(byte[] comp_ucode,
int start_offset)
Creates a CompUnicodeString from a byte array encoded in NetFinity-style compressed unicode format. |
|
CompUnicodeString(java.lang.String s)
Creates a CompUnicodeString from a provided String. |
Method Summary | |
---|---|
byte[] |
getCompUnicode()
Return byte array with compressed unicode encoding of value. |
static int |
GetEncodedLength(java.lang.String s)
Compute number of bytes needed for compressed unicode encoding of a given string. |
java.lang.String |
getString()
Return value of compressed unicode string as String. |
static boolean |
isEqual(java.lang.String str,
byte[] buf,
int off)
Compare a Java string with a compressed unicode string in a byte array. |
static java.lang.String |
readString(byte[] strbuf,
int off)
Read compressed unicode encoded string as java string |
static int |
writeString(java.lang.String str,
byte[] buf,
int off)
Write compressed unicode encoding of string into buffer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final long serialVersionUID
Constructor Detail |
public CompUnicodeString(java.lang.String s)
s
- the unicode string valuepublic CompUnicodeString(byte[] comp_ucode, int start_offset)
comp_ucode
- Array of bytes containing encoded stringstart_offset
- Offset in array of beginning of encoded stringMethod Detail |
public static final int GetEncodedLength(java.lang.String s)
s
- - string which is to be convertedpublic final java.lang.String getString()
public final byte[] getCompUnicode()
public static boolean isEqual(java.lang.String str, byte[] buf, int off)
str
- - string to be comparedbuf
- - buffer containing compressed unicode stringoff
- - offset of compressed unicode string in buffer
public static final java.lang.String readString(byte[] strbuf, int off)
strbuf
- - buffer containing stringoff
- - offset of string
public static final int writeString(java.lang.String str, byte[] buf, int off)
str
- - string to be encodedbuf
- - buffer to write tooff
- - offset of start of write
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |