Code example for CharsetDecoder

Methods: flush

0
     */ 
    private void flush() throws MalformedInputException, UnmappableCharacterException {
        CoderResult coderResult;
        decodedCharBuf.clear();
 
        coderResult = decoder.flush(decodedCharBuf);
        appendDecodedChars(); 
 
        throwIfError(coderResult);
 
        if (coderResult != UNDERFLOW) {
            throw new IllegalStateException("Decoder flush resulted in " + coderResult);
        } 
    } 
 
    /** 
     * If coderResult is considered an error (i.e. not overflow or underflow), throw the corresponding 
     * CharacterCodingException. 
     * 
     * @param coderResult result to check 
Experience pair programming with AI  Get Codota for Java