Code example for CharsetDecoder

Methods: decodeflush

0
        if (bytesRead <= 0) {
            return; 
        } 
        this.bbuf.flip();
        final boolean completed = decoder.isCompleted();
        CoderResult result = this.chardecoder.decode(this.bbuf, this.cbuf, completed);
        handleDecodingResult(result, ioctrl);
        this.bbuf.compact();
        if (completed) {
            result = this.chardecoder.flush(this.cbuf);
            handleDecodingResult(result, ioctrl);
        } 
    } 
 
    private void handleDecodingResult( 
            final CoderResult result, final IOControl ioctrl) throws IOException {
        if (result.isError()) {
            result.throwException();
        } 
        this.cbuf.flip();