Java in a Nutshell, 5th Edition [Electronic resources] نسخه متنی

اینجــــا یک کتابخانه دیجیتالی است

با بیش از 100000 منبع الکترونیکی رایگان به زبان فارسی ، عربی و انگلیسی

Java in a Nutshell, 5th Edition [Electronic resources] - نسخه متنی

| نمايش فراداده ، افزودن یک نقد و بررسی
افزودن به کتابخانه شخصی
ارسال به دوستان
جستجو در متن کتاب
بیشتر
تنظیمات قلم

فونت

اندازه قلم

+ - پیش فرض

حالت نمایش

روز نیمروز شب
جستجو در لغت نامه
بیشتر
لیست موضوعات
توضیحات
افزودن یادداشت جدید


CoderResultjava.nio.charset

Java 1.4

A CoderResult object
specifies the results of a call to CharsetDecoder.decode(
)
or CharsetEncoder.encode(
). There are four possible reasons why a call to the
decode( ) or encode( ) would
return:

  • If all the bytes have been decoded or all the characters have been
    encoded, and the input buffer is empty, then the return value is the
    constant object CoderResult.UNDERFLOW, indicating
    that coding stopped because there was no more data to code. Calling
    the isUnderflow( ) method on the returned object
    returns true and calling isError(
    ) returns false. This is a normal return
    value.

  • If there is more data to be coded, but there is no more room in the
    output buffer to store the coded data, then the return value is the
    constant object CoderResult.OVERFLOW. Calling
    isOverflow( ) on the returned object returns true,
    and calling isError( ) returns
    false. This is a normal return value.

  • If the input data was malformed, containing characters or bytes that
    are not legal for the charset, and the
    CharsetEncoder or
    CharsetDecoder has not specified that malformed
    input should be ignored or replaced, then the returned value is a
    CoderResult object whose isError(
    ) and isMalformed(
    ) methods both return true. The position
    of the input buffer is at the first malformed character or byte, and
    the length( )
    method of the returned object specifies how many characters or bytes
    are malformed.

  • If the input was well-formed, but contains characters or bytes that
    are "unmappable"that cannot be encoded or
    decoded in the specified charsetand if the
    CharsetEncoder or
    CharsetDecoder has not specified that unmappable
    characters should be ignored or replaced, then the returned value is
    a CoderResult object whose isError(
    ) and isUnmappable( ) methods both
    return true. The input buffer is positioned at the
    first unmappable character or byte, and the length(
    ) method of the CoderResult specifies
    the number of unmappable characters or bytes.


public class

CoderResult {
// No Constructor
// Public Constants
public static final CoderResult

OVERFLOW ;
public static final CoderResult

UNDERFLOW ;
// Public Class Methods
public static CoderResult

malformedForLength (int

length );
public static CoderResult

unmappableForLength (int

length );
// Public Instance Methods
public boolean

isError ( );
public boolean

isMalformed ( );
public boolean

isOverflow ( );
public boolean

isUnderflow ( );
public boolean

isUnmappable ( );
public int

length ( );
public void

throwException ( ) throws CharacterCodingException;
// Public Methods Overriding Object
public String

toString ( );
}


Returned By


CharsetDecoder.{decode( ), decodeLoop(
), flush( ), implFlush(
)}, CharsetEncoder.{encode( ),
encodeLoop( ), flush( ),
implFlush( )}


    / 1191