|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.kano.joscar.MinimalEncoder
Provides a means of encoding a set of strings in the "smallest" encoding
possible. This is useful when a set of data needs to have each member encoded
using the same charset, as in DirInfo
.
Field Summary | |
static java.lang.String |
ENCODING_ASCII
US-ASCII encoding. |
static java.lang.String |
ENCODING_ISO
ISO-8859-1 encoding. |
static java.lang.String |
ENCODING_UTF16
UTF-16BE encoding. |
static java.lang.String |
ENCODING_UTF8
UTF-8 encoding. |
Constructor Summary | |
MinimalEncoder()
|
Method Summary | |
EncodedStringInfo |
encode(java.lang.String str)
Encodes the given string using the minimal encoding computed from previous calls to update . |
static EncodedStringInfo |
encodeMinimally(java.lang.String str)
Encodes a string minimally. |
java.lang.String |
getCharset()
Returns the current minimal charset that can be used to encode all strings that have been passed to update thus far. |
void |
update(java.lang.String str)
Updates the current minimum charset to accommodate the given string. |
void |
updateAll(java.lang.String[] strings)
Simply a utility method for calling update on an entire
array of strings. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.String ENCODING_ASCII
public static final java.lang.String ENCODING_ISO
public static final java.lang.String ENCODING_UTF16
public static final java.lang.String ENCODING_UTF8
Constructor Detail |
public MinimalEncoder()
Method Detail |
public static EncodedStringInfo encodeMinimally(java.lang.String str)
new
MinimalEncoder().encode(str)
.
str
- the string to minimally encode
public final void update(java.lang.String str)
ENCODING_ASCII
,
after calling update(
hebrew text)
the
minimum charset would probably be ENCODING_UTF16
.
str
- the string to accommodatepublic final void updateAll(java.lang.String[] strings)
update
on an entire
array of strings.
strings
- the strings to accommodatepublic final java.lang.String getCharset()
update
thus far. Will
always be one of ENCODING_ASCII
, ENCODING_ISO
,
ENCODING_UTF16
, or in very rare cases (namely, a VM without
UTF-16BE encoding) ENCODING_UTF8
.
public final EncodedStringInfo encode(java.lang.String str)
update
. See getCharset()
for
details on possible values of the returned
EncodedStringInfo
's charset field.
str
- the string to encode
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |