Code example for CharsetDecoder

Methods: decodeflush

0
            if (x <= sizeTable[i]) return i + 1;
    } 
 
    public static void decode(CharsetDecoder charsetDecoder, ByteBuffer byteBuf, CharBuffer charByte) {
        try { 
            CoderResult cr = charsetDecoder.decode(byteBuf, charByte, true);
 
            if (!cr.isUnderflow()) {
                cr.throwException();
            } 
 
            cr = charsetDecoder.flush(charByte);
 
            if (!cr.isUnderflow()) {
                cr.throwException();
            } 
        } catch (CharacterCodingException x) {
            // Substitution is always enabled, 
            // so this shouldn't happen 
            throw new JSONException(x.getMessage(), x);
Contextual code suggestions in your IDE  Get Codota for Java