public final CoderResult decode (ByteBuffer in, CharBuffer out, boolean endOfInput)
public final CharBuffer decode (ByteBuffer in) throws CharacterCodingException
  public final CoderResult decode (ByteBuffer in, CharBuffer out,                                   boolean endOfInput)  {    int newState = endOfInput ? STATE_END : STATE_CODING;    // XXX: Need to check for "previous step was an invocation [not] of    // this method with a value of true for the endOfInput parameter but    // a return value indicating an incomplete decoding operation"    // XXX: We will not check the previous return value, just    // that the previous call passed true for endOfInput    if (state != STATE_RESET && state != STATE_CODING        && !(endOfInput && state == STATE_END))      throw new IllegalStateException ();    state = newState;    for (;;)      {        CoderResult cr;        try          {            cr = decodeLoop (in, out);          }        catch (RuntimeException e)          {            throw new CoderMalfunctionError (e);          }        if (cr.isOverflow ())          return cr;        if (cr.isUnderflow ())          {            if (endOfInput && in.hasRemaining ())              cr = CoderResult.malformedForLength (in.remaining ());            else              return cr;          }        CodingErrorAction action = cr.isMalformed ()                                     ? malformedInputAction                                     : unmappableCharacterAction;        if (action == CodingErrorAction.REPORT)          return cr;        if (action == CodingErrorAction.REPLACE)          {            if (out.remaining () < replacement.length ())              return CoderResult.OVERFLOW;            out.put (replacement);          }        in.position (in.position () + cr.length ());      }  }