| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
CharsetDecoder cd = …;
ByteBuffer bb = …;
CharBuffer cb = …;
CoderResult cr = cd.decode(bb, cb, true);
Based on 11 examples
CharsetEncoder ce = …;
CharBuffer tmpcb = …;
ByteBuffer bb = …;
CoderResult cr = ce.encode(tmpcb, bb, true);
Based on 8 examples
public class CoderResult extends Object
A description of the result state of a coder.
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 {@link #UNDERFLOW}, whose {@link #isUnderflow() 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 {@link #OVERFLOW}, whose {@link #isOverflow() 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 {@link #isMalformed() isMalformed} method returns true and whose {@link #length() 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 {@link #isUnmappable() isUnmappable} method returns true and whose {@link #length() 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.
Field Summary | |
---|---|
static CoderResult |
OVERFLOW
Result object indicating overflow, meaning that there is insufficient room in the output buffer. |
static 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. |
Method Summary | |
---|---|
boolean |
isError() Tells whether or not this object describes an error condition. |
boolean |
Tells whether or not this object describes a malformed-input error. |
boolean |
Tells whether or not this object describes an overflow condition. |
boolean |
Tells whether or not this object describes an underflow condition. |
boolean |
Tells whether or not this object describes an unmappable-character error. |
int |
length() Returns the length of the erroneous input described by this object (optional operation). |
static CoderResult |
malformedForLength(int length) Static factory method that returns the unique object describing a malformed-input error of the given length. |
void |
Throws an exception appropriate to the result described by this object. |
String |
toString() Returns a string describing this coder result. |
static CoderResult |
unmappableForLength(int length) Static factory method that returns the unique result object describing an unmappable-character error of the given length. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final CoderResult OVERFLOW
public static final CoderResult UNDERFLOW
Method Detail |
---|
public boolean isError()
public boolean isMalformed()
public boolean isOverflow()
public boolean isUnderflow()
public boolean isUnmappable()
public int length()
public static CoderResult malformedForLength(int length)
length
public void throwException() throws CharacterCodingException
CharacterCodingException
public String toString()
toString
in class Object
public static CoderResult unmappableForLength(int length)
length
| |||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |