code: 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();
      }
docs: Fills the internal char buffer from the reader.
  
  @throws IOException If an I/O error occurs