A charset coder, that is, either a decoder or an encoder, consumes bytes (or characters) from an input buffer, translates them, and writes the resulting characters (or bytes) to an output buffer. A coding process terminates for one of four categories of reasons, which are described by instances of this class:
Underflow is reported when there is no more input to be
processed, or there is insufficient input and additional input is
required. This condition is represented by the unique result object
UNDERFLOW, whose isUnderflow method
returns true.
Overflow is reported when there is insufficient room
remaining in the output buffer. This condition is represented by the
unique result object OVERFLOW, whose isOverflow method returns true.
A malformed-input error is reported when a sequence of
input units is not well-formed. Such errors are described by instances of
this class whose isMalformed method returns
true and whose length method returns the length
of the malformed sequence. There is one unique instance of this class for
all malformed-input errors of a given length.
An unmappable-character error is reported when a sequence
of input units denotes a character that cannot be represented in the
output charset. Such errors are described by instances of this class
whose isUnmappable method returns true and
whose length method returns the length of the input
sequence denoting the unmappable character. There is one unique instance
of this class for all unmappable-character errors of a given length.
For convenience, the isError method returns true
for result objects that describe malformed-input and unmappable-character
errors but false for those that describe underflow or overflow
conditions.
| Modifier and Type | Class and Description |
|---|---|
| private static class |
| Modifier and Type | Field and Description |
|---|---|
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private final int | |
| private static final CoderResult[] | |
| private static final String[] | |
| public static final CoderResult | OVERFLOW
Result object indicating overflow, meaning that there is insufficient room in the output buffer. |
| private final int | |
| public static final CoderResult | UNDERFLOW
Result object indicating underflow, meaning that either the input buffer has been completely consumed or, if the input buffer is not yet empty, that additional input is required. |
| private static final CoderResult[] |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| public boolean | Returns: true if, and only if, this object denotes either a
malformed-input error or an unmappable-character errorTells whether or not this object describes an error condition. |
| public boolean | Returns: true if, and only if, this object denotes a
malformed-input errorTells whether or not this object describes a malformed-input error. |
| public boolean | Returns: true if, and only if, this object denotes overflowTells whether or not this object describes an overflow condition. |
| public boolean | Returns: true if, and only if, this object denotes underflowTells whether or not this object describes an underflow condition. |
| public boolean | Returns: true if, and only if, this object denotes an
unmappable-character errorTells whether or not this object describes an unmappable-character error. |
| public int | Returns: The length of the erroneous input, a positive integerReturns the length of the erroneous input described by this object (optional operation). |
| public static CoderResult | Returns: The requested coder-result objectThe given length length)Static factory method that returns the unique object describing a malformed-input error of the given length. |
| public void | |
| public String | Returns: A descriptive stringOverrides java. Returns a string describing this coder result. |
| public static CoderResult | Returns: The requested coder-result objectThe given length length)Static factory method that returns the unique result object describing an unmappable-character error of the given length. |
| CR_ERROR_MIN | back to summary |
|---|---|
| private static final int CR_ERROR_MIN | |
| CR_MALFORMED | back to summary |
|---|---|
| private static final int CR_MALFORMED | |
| CR_OVERFLOW | back to summary |
|---|---|
| private static final int CR_OVERFLOW | |
| CR_UNDERFLOW | back to summary |
|---|---|
| private static final int CR_UNDERFLOW | |
| CR_UNMAPPABLE | back to summary |
|---|---|
| private static final int CR_UNMAPPABLE | |
| length | back to summary |
|---|---|
| private final int length | |
| malformed4 | back to summary |
|---|---|
| private static final CoderResult[] malformed4 | |
| names | back to summary |
|---|---|
| private static final String[] names | |
| OVERFLOW | back to summary |
|---|---|
| public static final CoderResult OVERFLOW Result object indicating overflow, meaning that there is insufficient room in the output buffer. | |
| type | back to summary |
|---|---|
| private final int type | |
| UNDERFLOW | back to summary |
|---|---|
| public static final CoderResult UNDERFLOW Result object indicating underflow, meaning that either the input buffer has been completely consumed or, if the input buffer is not yet empty, that additional input is required. | |
| unmappable4 | back to summary |
|---|---|
| private static final CoderResult[] unmappable4 | |
| CoderResult | back to summary |
|---|---|
| private CoderResult(int type, int length) | |
| isError | back to summary |
|---|---|
| public boolean isError() Tells whether or not this object describes an error condition.
| |
| isMalformed | back to summary |
|---|---|
| public boolean isMalformed() Tells whether or not this object describes a malformed-input error.
| |
| isOverflow | back to summary |
|---|---|
| public boolean isOverflow() Tells whether or not this object describes an overflow condition.
| |
| isUnderflow | back to summary |
|---|---|
| public boolean isUnderflow() Tells whether or not this object describes an underflow condition.
| |
| isUnmappable | back to summary |
|---|---|
| public boolean isUnmappable() Tells whether or not this object describes an unmappable-character error.
| |
| length | back to summary |
|---|---|
| public int length() Returns the length of the erroneous input described by this object (optional operation).
| |
| malformedForLength | back to summary |
|---|---|
| public static CoderResult malformedForLength(int length) Static factory method that returns the unique object describing a malformed-input error of the given length.
| |
| throwException | back to summary |
|---|---|
| public void throwException() throws CharacterCodingException Throws an exception appropriate to the result described by this object.
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Returns a string describing this coder result.
| |
| unmappableForLength | back to summary |
|---|---|
| public static CoderResult unmappableForLength(int length) Static factory method that returns the unique result object describing an unmappable-character error of the given length.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv static final CoderResult. | |
| pack-priv final Map | |
| pack-priv final Map |
| Access | Constructor and Description |
|---|---|
| private |
| INSTANCE | back to summary |
|---|---|
| pack-priv static final CoderResult. | |
| malformed | back to summary |
|---|---|
| pack-priv final Map<Integer, CoderResult> malformed | |
| unmappable | back to summary |
|---|---|
| pack-priv final Map<Integer, CoderResult> unmappable | |
| Cache | back to summary |
|---|---|
| private Cache() | |