public enum SignatureCharset extends Enum<SignatureCharset>
Signature) coupled with a charset
(UnicodeCharset) that may follow the signature (aka a
signature/charset pair). Observe that, in the absence of a
signature (Signature.NONE), many different charsets are
allowed. Instances of this class enforce signature removal upon
decoding and insertion upon charset; there is no attempt made to
identify matching signatures, as done by Serialization.| Enum Constant and Description |
|---|
NONE_UTF16BE |
NONE_UTF16LE |
NONE_UTF32BE |
NONE_UTF32LE |
NONE_UTF8 |
UTF16BE_UTF16BE |
UTF16LE_UTF16LE |
UTF32BE_UTF32BE |
UTF32LE_UTF32LE |
UTF8_UTF8 |
| Modifier and Type | Method and Description |
|---|---|
void |
assertSupported()
Asserts that the JVM supports the receiver's charset.
|
String |
decode(byte[] data)
Decodes the given byte array using the receiver's charset, and
returns the result.
|
byte[] |
encode(String data)
Encodes the given string using the receiver's charset, and
returns the result.
|
UnicodeCharset |
getCharset()
Returns the receiver's charset.
|
Signature |
getSignature()
Returns the receiver's signature.
|
boolean |
isSupported()
Checks whether the JVM supports the receiver's charset.
|
static SignatureCharset |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static SignatureCharset[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final SignatureCharset NONE_UTF8
public static final SignatureCharset NONE_UTF16BE
public static final SignatureCharset NONE_UTF16LE
public static final SignatureCharset NONE_UTF32BE
public static final SignatureCharset NONE_UTF32LE
public static final SignatureCharset UTF8_UTF8
public static final SignatureCharset UTF16BE_UTF16BE
public static final SignatureCharset UTF16LE_UTF16LE
public static final SignatureCharset UTF32BE_UTF32BE
public static final SignatureCharset UTF32LE_UTF32LE
public static SignatureCharset[] values()
for (SignatureCharset c : SignatureCharset.values()) System.out.println(c);
public static SignatureCharset valueOf(String name)
name - the name of the enum constant to be returned.IllegalArgumentException - if this enum type has no constant
with the specified nameNullPointerException - if the argument is nullpublic Signature getSignature()
public UnicodeCharset getCharset()
public boolean isSupported()
public void assertSupported()
throws I18NException
I18NException - Thrown if it does not.public String decode(byte[] data) throws I18NException
data - The byte array, which may be null.I18NException - Thrown if the receiver's charset is not a
supported JVM charset.public byte[] encode(String data) throws I18NException
data - The string, which may be null.I18NException - Thrown if the receiver's charset is not a
supported JVM charset.Copyright © 2015. All Rights Reserved.