public class EncodedText extends Object
| Modifier and Type | Field and Description |
|---|---|
private static byte[][] |
boms |
private static String[] |
characterSets |
static String |
CHARSET_ISO_8859_1 |
static String |
CHARSET_UTF_16 |
static String |
CHARSET_UTF_16BE |
static String |
CHARSET_UTF_8 |
private static byte[][] |
terminators |
static byte |
TEXT_ENCODING_ISO_8859_1 |
static byte |
TEXT_ENCODING_UTF_16 |
static byte |
TEXT_ENCODING_UTF_16BE |
static byte |
TEXT_ENCODING_UTF_8 |
private byte |
textEncoding |
private static byte[] |
textEncodingFallback |
private byte[] |
value |
| Constructor and Description |
|---|
EncodedText(byte[] value) |
EncodedText(byte textEncoding,
byte[] value) |
EncodedText(byte textEncoding,
String string) |
EncodedText(String string) |
EncodedText(String string,
byte transcodeToTextEncoding) |
| Modifier and Type | Method and Description |
|---|---|
protected static CharBuffer |
bytesToCharBuffer(byte[] bytes,
String characterSet) |
private static String |
bytesToString(byte[] bytes,
String characterSet) |
private static String |
characterSetForTextEncoding(byte textEncoding) |
protected static byte[] |
charBufferToBytes(CharBuffer charBuffer,
String characterSet) |
boolean |
equals(Object obj) |
String |
getCharacterSet() |
byte[] |
getTerminator() |
byte |
getTextEncoding() |
int |
hashCode() |
void |
setTextEncoding(byte textEncoding) |
void |
setTextEncoding(byte textEncoding,
boolean transcode) |
private static byte[] |
stringToBytes(String s,
String characterSet) |
private void |
stripBomAndTerminator() |
private static byte |
textEncodingForBytesFromBOM(byte[] value) |
byte[] |
toBytes() |
byte[] |
toBytes(boolean includeBom) |
byte[] |
toBytes(boolean includeBom,
boolean includeTerminator) |
String |
toString() |
public static final byte TEXT_ENCODING_ISO_8859_1
public static final byte TEXT_ENCODING_UTF_16
public static final byte TEXT_ENCODING_UTF_16BE
public static final byte TEXT_ENCODING_UTF_8
public static final String CHARSET_ISO_8859_1
public static final String CHARSET_UTF_16
public static final String CHARSET_UTF_16BE
public static final String CHARSET_UTF_8
private static final String[] characterSets
private static final byte[] textEncodingFallback
private static final byte[][] boms
private static final byte[][] terminators
private byte[] value
private byte textEncoding
public EncodedText(byte textEncoding,
byte[] value)
public EncodedText(String string) throws IllegalArgumentException
IllegalArgumentExceptionpublic EncodedText(String string, byte transcodeToTextEncoding) throws IllegalArgumentException, CharacterCodingException
public EncodedText(byte textEncoding,
String string)
public EncodedText(byte[] value)
private static byte textEncodingForBytesFromBOM(byte[] value)
private static String characterSetForTextEncoding(byte textEncoding)
private void stripBomAndTerminator()
public byte getTextEncoding()
public void setTextEncoding(byte textEncoding)
throws CharacterCodingException
CharacterCodingExceptionpublic void setTextEncoding(byte textEncoding,
boolean transcode)
throws CharacterCodingException
CharacterCodingExceptionpublic byte[] getTerminator()
public byte[] toBytes()
public byte[] toBytes(boolean includeBom)
public byte[] toBytes(boolean includeBom,
boolean includeTerminator)
public String getCharacterSet()
private static String bytesToString(byte[] bytes, String characterSet) throws CharacterCodingException
CharacterCodingExceptionprotected static CharBuffer bytesToCharBuffer(byte[] bytes, String characterSet) throws CharacterCodingException
CharacterCodingExceptionprotected static byte[] charBufferToBytes(CharBuffer charBuffer, String characterSet) throws CharacterCodingException
CharacterCodingException