java.nio.charset
Class CoderResult

java.lang.Object sample code for java.lang.Object definition code for java.lang.Object 
  extended by java.nio.charset.CoderResult

public class CoderResult
extends Object sample code for java.lang.Object definition code for java.lang.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 isError sample code for java.nio.charset.CoderResult.isError() definition code for java.nio.charset.CoderResult.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.

Since:
1.4

Field Summary
static CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.CoderResult OVERFLOW sample code for java.nio.charset.CoderResult.OVERFLOW definition code for java.nio.charset.CoderResult.OVERFLOW
          Result object indicating overflow, meaning that there is insufficient room in the output buffer.
static CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.CoderResult UNDERFLOW sample code for java.nio.charset.CoderResult.UNDERFLOW definition code for java.nio.charset.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 sample code for java.nio.charset.CoderResult.isError() definition code for java.nio.charset.CoderResult.isError() ()
          Tells whether or not this object describes an error condition.
 boolean isMalformed sample code for java.nio.charset.CoderResult.isMalformed() definition code for java.nio.charset.CoderResult.isMalformed() ()
          Tells whether or not this object describes a malformed-input error.
 boolean isOverflow sample code for java.nio.charset.CoderResult.isOverflow() definition code for java.nio.charset.CoderResult.isOverflow() ()
          Tells whether or not this object describes an overflow condition.
 boolean isUnderflow sample code for java.nio.charset.CoderResult.isUnderflow() definition code for java.nio.charset.CoderResult.isUnderflow() ()
          Tells whether or not this object describes an underflow condition.
 boolean isUnmappable sample code for java.nio.charset.CoderResult.isUnmappable() definition code for java.nio.charset.CoderResult.isUnmappable() ()
          Tells whether or not this object describes an unmappable-character error.
 int length sample code for java.nio.charset.CoderResult.length() definition code for java.nio.charset.CoderResult.length() ()
          Returns the length of the erroneous input described by this object  (optional operation).
static CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.CoderResult malformedForLength sample code for java.nio.charset.CoderResult.malformedForLength(int) definition code for java.nio.charset.CoderResult.malformedForLength(int) (int length)
          Static factory method that returns the unique object describing a malformed-input error of the given length.
 void throwException sample code for java.nio.charset.CoderResult.throwException() definition code for java.nio.charset.CoderResult.throwException() ()
          Throws an exception appropriate to the result described by this object.
 String sample code for java.lang.String definition code for java.lang.String toString sample code for java.nio.charset.CoderResult.toString() definition code for java.nio.charset.CoderResult.toString() ()
          Returns a string describing this coder result.
static CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.CoderResult unmappableForLength sample code for java.nio.charset.CoderResult.unmappableForLength(int) definition code for java.nio.charset.CoderResult.unmappableForLength(int) (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 sample code for java.lang.Object definition code for java.lang.Object
clone sample code for java.lang.Object.clone() definition code for java.lang.Object.clone() , equals sample code for java.lang.Object.equals(java.lang.Object) definition code for java.lang.Object.equals(java.lang.Object) , finalize sample code for java.lang.Object.finalize() definition code for java.lang.Object.finalize() , getClass sample code for java.lang.Object.getClass() definition code for java.lang.Object.getClass() , hashCode sample code for java.lang.Object.hashCode() definition code for java.lang.Object.hashCode() , notify sample code for java.lang.Object.notify() definition code for java.lang.Object.notify() , notifyAll sample code for java.lang.Object.notifyAll() definition code for java.lang.Object.notifyAll() , wait sample code for java.lang.Object.wait() definition code for java.lang.Object.wait() , wait sample code for java.lang.Object.wait(long) definition code for java.lang.Object.wait(long) , wait sample code for java.lang.Object.wait(long, int) definition code for java.lang.Object.wait(long, int)
 

Field Detail

UNDERFLOW sample code for java.nio.charset.CoderResult.UNDERFLOW

public static final CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.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.


OVERFLOW sample code for java.nio.charset.CoderResult.OVERFLOW

public static final CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.CoderResult  OVERFLOW
Result object indicating overflow, meaning that there is insufficient room in the output buffer.

Method Detail

toString sample code for java.nio.charset.CoderResult.toString() definition code for java.nio.charset.CoderResult.toString()

public String sample code for java.lang.String definition code for java.lang.String  toString()
Returns a string describing this coder result.

Overrides:
toString sample code for java.lang.Object.toString() definition code for java.lang.Object.toString() in class Object sample code for java.lang.Object definition code for java.lang.Object
Returns:
A descriptive string

isUnderflow sample code for java.nio.charset.CoderResult.isUnderflow() definition code for java.nio.charset.CoderResult.isUnderflow()

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

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

isOverflow sample code for java.nio.charset.CoderResult.isOverflow() definition code for java.nio.charset.CoderResult.isOverflow()

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

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

isError sample code for java.nio.charset.CoderResult.isError() definition code for java.nio.charset.CoderResult.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 sample code for java.nio.charset.CoderResult.isMalformed() definition code for java.nio.charset.CoderResult.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

isUnmappable sample code for java.nio.charset.CoderResult.isUnmappable() definition code for java.nio.charset.CoderResult.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 sample code for java.nio.charset.CoderResult.length() definition code for java.nio.charset.CoderResult.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
Throws:
UnsupportedOperationException sample code for java.lang.UnsupportedOperationException definition code for java.lang.UnsupportedOperationException - If this object does not describe an error condition, that is, if the isError sample code for java.nio.charset.CoderResult.isError() definition code for java.nio.charset.CoderResult.isError() does not return true

malformedForLength sample code for java.nio.charset.CoderResult.malformedForLength(int) definition code for java.nio.charset.CoderResult.malformedForLength(int)

public static CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.CoderResult  malformedForLength(int length)
Static factory method that returns the unique object describing a malformed-input error of the given length.

Returns:
The requested coder-result object

unmappableForLength sample code for java.nio.charset.CoderResult.unmappableForLength(int) definition code for java.nio.charset.CoderResult.unmappableForLength(int)

public static CoderResult sample code for java.nio.charset.CoderResult definition code for java.nio.charset.CoderResult  unmappableForLength(int length)
Static factory method that returns the unique result object describing an unmappable-character error of the given length.

Returns:
The requested coder-result object

throwException sample code for java.nio.charset.CoderResult.throwException() definition code for java.nio.charset.CoderResult.throwException()

public void throwException()
                    throws CharacterCodingException sample code for java.nio.charset.CharacterCodingException definition code for java.nio.charset.CharacterCodingException 
Throws an exception appropriate to the result described by this object.

Throws:
BufferUnderflowException sample code for java.nio.BufferUnderflowException definition code for java.nio.BufferUnderflowException - If this object is UNDERFLOW sample code for java.nio.charset.CoderResult.UNDERFLOW definition code for java.nio.charset.CoderResult.UNDERFLOW
BufferOverflowException sample code for java.nio.BufferOverflowException definition code for java.nio.BufferOverflowException - If this object is OVERFLOW sample code for java.nio.charset.CoderResult.OVERFLOW definition code for java.nio.charset.CoderResult.OVERFLOW
MalformedInputException sample code for java.nio.charset.MalformedInputException definition code for java.nio.charset.MalformedInputException - If this object represents a malformed-input error; the exception's length value will be that of this object
UnmappableCharacterException sample code for java.nio.charset.UnmappableCharacterException definition code for java.nio.charset.UnmappableCharacterException - If this object represents an unmappable-character error; the exceptions length value will be that of this object
CharacterCodingException sample code for java.nio.charset.CharacterCodingException definition code for java.nio.charset.CharacterCodingException