This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.


java.nio.charset
class CoderResult

java.lang.Object extended by java.nio.charset.CoderResult

Most common ways to construct:

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:

For convenience, the {@link #isError() 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.


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

          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

          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

          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

OVERFLOW

public static final CoderResult OVERFLOW
Result object indicating overflow, meaning that there is insufficient room in the output buffer.


UNDERFLOW

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.

Method Detail

isError

public boolean isError()
Tells whether or not this object describes an error condition.

Returns:
true if, and only if, this object denotes either a malformed-input error or an unmappable-character error

isMalformed

public boolean isMalformed()
Tells whether or not this object describes a malformed-input error.

Returns:
true if, and only if, this object denotes a malformed-input error

isOverflow

public boolean isOverflow()
Tells whether or not this object describes an overflow condition.

Returns:
true if, and only if, this object denotes overflow

isUnderflow

public boolean isUnderflow()
Tells whether or not this object describes an underflow condition.

Returns:
true if, and only if, this object denotes underflow

isUnmappable

public boolean isUnmappable()
Tells whether or not this object describes an unmappable-character error.

Returns:
true if, and only if, this object denotes an unmappable-character error

length

public int length()
Returns the length of the erroneous input described by this object  (optional operation).

Returns:
The length of the erroneous input, a positive integer

malformedForLength

public static CoderResult malformedForLength(int length)
Static factory method that returns the unique object describing a malformed-input error of the given length.

Parameters:
length
Returns:
The requested coder-result object

throwException

public void throwException()
                    throws CharacterCodingException
Throws an exception appropriate to the result described by this object.

Throws:
CharacterCodingException

toString

public String toString()
Returns a string describing this coder result.

Overrides:
toString in class Object
Returns:
A descriptive string

unmappableForLength

public static CoderResult unmappableForLength(int length)
Static factory method that returns the unique result object describing an unmappable-character error of the given length.

Parameters:
length
Returns:
The requested coder-result object


This documentation differs from the official API. Jadeite adds extra features to the API including: variable font sizes, constructions examples, placeholders for classes and methods, and auto-generated “See Also” links. Additionally it is missing some items found in standard Javadoc documentation, including: generics type information, “Deprecated” tags and comments, “See Also” links, along with other minor differences. Please send any questions or feedback to bam@cs.cmu.edu.
This page displays the Jadeite version of the documention, which is derived from the offical documentation that contains this copyright notice:
Copyright 2008 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
The official Sun™ documentation can be found here at http://java.sun.com/javase/6/docs/api/.