|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.vgrs.xcode.common.Native
public final class Native
A class that provides algorithms to encode/decode a UTF 16 to/from native
characters.
Note: when using JVM 1.4 or greater, the String.getBytes() method can return
a java.nio.BufferOverflowException.
(e.g. byte[] b = new String("?").getBytes("ISO2022KR");
It is not possible to catch the java.nio.BufferOverflowException specifically
because this won't compile on an older JVM. Instead, the internalDecode()
method now catches any Exception and covers it with a
XcodeError.NATIVE_INVALID_ENCODING.
| Field Summary | |
|---|---|
static java.lang.String |
DOUBLE_UTF8
DOUBLE_UTF8 is not a Java supported encoding, and so requires special processing. |
static java.lang.String[] |
ENCODINGS
Array to stort all Java-Supported native encodings |
static java.lang.String |
UTF8
Java UTF8 encoding type, used to abstract the Java internals. |
| Constructor Summary | |
|---|---|
Native()
|
|
| Method Summary | |
|---|---|
static java.util.Map<java.lang.String,java.lang.String> |
decode(byte[] aInput)
Evaluate the given input against the list of encodings to determine how the input may have been encoded. |
static java.lang.String |
decode(byte[] aInput,
java.lang.String aEncoding)
Use the specified native encoding to return the input sequence in UTF16 format. |
static java.util.Map<java.lang.String,java.lang.String> |
decode(byte[] aInput,
java.lang.String[] aEncodings)
Decode the input of the indicated encoding types. |
static java.util.Set<java.lang.String> |
decodeToSet(byte[] aInput)
Decode the native string of all encoding types to a HashSet |
static java.util.Set<java.lang.String> |
decodeToSet(byte[] aInput,
java.lang.String[] aEncodings)
Decode the native string of indicated encoding types to a HashSet |
static java.util.Map<java.lang.String,java.lang.String> |
encode(java.lang.String aInput)
Encode the input using each of the Java supported encoding types A round-trip check is used to ensure that the encoded data is valid. |
static java.lang.String |
encode(java.lang.String aInput,
java.lang.String aEncoding)
Encode the input using the indicated encoding types. |
static java.util.Map<java.lang.String,java.lang.String> |
encode(java.lang.String aInput,
java.lang.String[] aEncodings)
Encode the input using the indicated encoding types. |
static java.util.Set<java.lang.String> |
encodeToSet(java.lang.String aInput)
Encode the input using each of the encoding types to a HashSet |
static java.util.Set<java.lang.String> |
encodeToSet(java.lang.String aInput,
java.lang.String[] aEncodings)
Encode the input using indicated encoding types to a HashSet |
static byte[] |
getEncoding(java.lang.String aInput)
Retrieve the encoding stored in a Java String. |
| 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 UTF8
public static final java.lang.String DOUBLE_UTF8
public static final java.lang.String[] ENCODINGS
| Constructor Detail |
|---|
public Native()
| Method Detail |
|---|
public static byte[] getEncoding(java.lang.String aInput)
throws XcodeException
aInput - the String holding the encoded data
XcodeException - if the input is null/empty or if any high byte is non-zero
public static java.util.Map<java.lang.String,java.lang.String> encode(java.lang.String aInput)
throws XcodeException
aInput - the string to be encoded
XcodeException - if input is null or empty string.
public static java.lang.String encode(java.lang.String aInput,
java.lang.String aEncoding)
throws XcodeException
aInput - string to be encodedaEncoding - string to indicate the encoding type of the output
XcodeException - if input is null or empty string or if the named charset is not
supported
public static java.util.Map<java.lang.String,java.lang.String> encode(java.lang.String aInput,
java.lang.String[] aEncodings)
throws XcodeException
aInput - the string to be encodedaEncodings - indicate the encoding types of the output string
XcodeException - if input is null or empty string or if the named charset is not
supported
public static java.util.Set<java.lang.String> encodeToSet(java.lang.String aInput)
throws XcodeException
aInput - the string to be encoded
XcodeException - if input is null or empty string.
public static java.util.Set<java.lang.String> encodeToSet(java.lang.String aInput,
java.lang.String[] aEncodings)
throws XcodeException
aInput - the string to be encodedaEncodings - encoding types of the decoded string
XcodeException - if input is null or empty string.
public static java.util.Map<java.lang.String,java.lang.String> decode(byte[] aInput)
throws XcodeException
aInput - the bytes to be decoded into characters
XcodeException - If the named charset is not supported
public static java.lang.String decode(byte[] aInput,
java.lang.String aEncoding)
throws XcodeException
aInput - the bytes to be decodedaEncoding - the encoding type to be used in decoding
XcodeException - if input is null or empty string or if the named charset is not
supported
public static java.util.Map<java.lang.String,java.lang.String> decode(byte[] aInput,
java.lang.String[] aEncodings)
throws XcodeException
aInput - the native string to be decodeaEncodings - indicate the encoding types of the input string
XcodeException - if input is null or empty string or if the named charset is not
supported
public static java.util.Set<java.lang.String> decodeToSet(byte[] aInput)
throws XcodeException
aInput - the string to be decoded
XcodeException - if input is null or empty string.
public static java.util.Set<java.lang.String> decodeToSet(byte[] aInput,
java.lang.String[] aEncodings)
throws XcodeException
aInput - the string to be decodedaEncodings - encoding types of the decoded string
XcodeException - if input is null or empty string.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||