Code example for CharBuffer

Methods: flippositionremainingarraycompact

0
     * @throws IOException 
     *             If an I/O error occurs 
     */ 
    private void fillBuffer() throws IOException { 
        if (!endOfInput && (lastCoderResult == null || lastCoderResult.isUnderflow())) {
            encoderIn.compact();
            int position = encoderIn.position();
            // We don't use Reader#read(CharBuffer) here because it is more efficient 
            // to write directly to the underlying char array (the default implementation 
            // copies data to a temporary char array). 
            int c = reader.read(encoderIn.array(), position, encoderIn.remaining());
            if (c == -1) {
                endOfInput = true;
            } else { 
                encoderIn.position(position+c);
            } 
            encoderIn.flip();
        } 
        encoderOut.compact();
        lastCoderResult = encoder.encode(encoderIn, encoderOut, endOfInput);
        encoderOut.flip();
    } 
Contextual code suggestions in your IDE  Get Codota for Java