Class EscapedByteLookupCharset
- All Implemented Interfaces:
Comparable<Charset>
- Direct Known Subclasses:
GSMCharset
- Since:
- 2007-03-26
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected class
The Decoder inner class handles the decoding of the charset using the inverse lookup tables.protected class
The Encoder inner class handles the encoding of the charset using the lookup tables. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
EscapedByteLookupCharset
(String canonicalName, String[] aliases, byte escape, int[] byteToChar, int[] byteToCharEscaped, int[][] charToByte, int[][] charToByteEscaped) Initializes a new charset with the given canonical name and alias set, and byte-to-char/char-to-byte lookup tables. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Tells whether or not this charset contains the given charset.Constructs a new decoder for this charset.Constructs a new encoder for this charset.Methods inherited from class java.nio.charset.Charset
aliases, availableCharsets, canEncode, compareTo, decode, defaultCharset, displayName, displayName, encode, encode, equals, forName, hashCode, isRegistered, isSupported, name, toString
-
Constructor Details
-
EscapedByteLookupCharset
protected EscapedByteLookupCharset(String canonicalName, String[] aliases, byte escape, int[] byteToChar, int[] byteToCharEscaped, int[][] charToByte, int[][] charToByteEscaped) Initializes a new charset with the given canonical name and alias set, and byte-to-char/char-to-byte lookup tables.- Parameters:
canonicalName
- The canonical name of this charsetaliases
- An array of this charset's aliases, or null if it has no aliasesescape
- the special escape byte valuebyteToChar
- a byte-to-char conversion table for this charsetbyteToCharEscaped
- a byte-to-char conversion table for this charset for the escaped characterscharToByte
- a char-to-byte conversion table for this charset. It can be generated on-the-fly by callingcreateInverseLookupTable(byteToChar)
.charToByteEscaped
- a char-to-byte conversion table for this charset for the escaped characters- Throws:
IllegalCharsetNameException
- If the canonical name or any of the aliases are illegal
-
-
Method Details
-
contains
Tells whether or not this charset contains the given charset.A charset C is said to contain a charset D if, and only if, every character representable in D is also representable in C. If this relationship holds then it is guaranteed that every string that can be encoded in D can also be encoded in C without performing any replacements.
That C contains D does not imply that each character representable in C by a particular byte sequence is represented in D by the same byte sequence, although sometimes this is the case.
Every charset contains itself.
This method computes an approximation of the containment relation: If it returns true then the given charset is known to be contained by this charset; if it returns false, however, then it is not necessarily the case that the given charset is not contained in this charset.
-
newDecoder
Constructs a new decoder for this charset.- Specified by:
newDecoder
in classCharset
- Returns:
- A new decoder for this charset
-
newEncoder
Constructs a new encoder for this charset.- Specified by:
newEncoder
in classCharset
- Returns:
- A new encoder for this charset
- Throws:
UnsupportedOperationException
- If this charset does not support encoding
-