public class CoderResult extends Object
CoderResult.UNDERFLOW
.
CoderResult.OVERFLOW
.
CoderResult.malformedForLength(int)
with the length of
the malformed-input.
CoderResult.unmappableForLength(int)
with
the input sequence size indicating the identity of the unmappable character.
Modifier and Type | Field and Description |
---|---|
static CoderResult |
OVERFLOW
Result object used to indicate that the output buffer does not have
enough space available to store the result of the encoding/decoding.
|
static CoderResult |
UNDERFLOW
Result object indicating that there is insufficient data in the
encoding/decoding buffer or that additional data is required.
|
Modifier and Type | Method and Description |
---|---|
boolean |
isError()
Returns true if this result represents a malformed-input error or an
unmappable-character error.
|
boolean |
isMalformed()
Returns true if this result represents a malformed-input error.
|
boolean |
isOverflow()
Returns true if this result is an overflow condition.
|
boolean |
isUnderflow()
Returns true if this result is an underflow condition.
|
boolean |
isUnmappable()
Returns true if this result represents an unmappable-character error.
|
int |
length()
Gets the length of the erroneous input.
|
static CoderResult |
malformedForLength(int length)
Gets a
CoderResult object indicating a malformed-input
error. |
void |
throwException()
Throws an exception corresponding to this coder result.
|
String |
toString()
Returns a text description of this result.
|
static CoderResult |
unmappableForLength(int length)
Gets a
CoderResult object indicating an unmappable
character error. |
public static final CoderResult UNDERFLOW
public static final CoderResult OVERFLOW
public static CoderResult malformedForLength(int length) throws IllegalArgumentException
CoderResult
object indicating a malformed-input
error.length
- the length of the malformed-input.CoderResult
object indicating a malformed-input
error.IllegalArgumentException
- if length
is non-positive.public static CoderResult unmappableForLength(int length) throws IllegalArgumentException
CoderResult
object indicating an unmappable
character error.length
- the length of the input unit sequence denoting the unmappable
character.CoderResult
object indicating an unmappable
character error.IllegalArgumentException
- if length
is non-positive.public boolean isUnderflow()
public boolean isError()
public boolean isMalformed()
public boolean isOverflow()
public boolean isUnmappable()
public int length() throws UnsupportedOperationException
UnsupportedOperationException
- if this result is an overflow or underflow.public void throwException() throws BufferUnderflowException, BufferOverflowException, UnmappableCharacterException, MalformedInputException, CharacterCodingException
BufferUnderflowException
- in case this is an underflow.BufferOverflowException
- in case this is an overflow.UnmappableCharacterException
- in case this is an unmappable-character error.MalformedInputException
- in case this is a malformed-input error.CharacterCodingException
- the default exception.