flushWriteBuffer();
} else if (res == CoderResult.UNDERFLOW && char_buf.hasRemaining()) {
// Create new underflow buf containing the remaining chars and room
// for one more char. The longest sequence of characters that can
// represent a single code point is 2 (a pair of surrogate chars).
underflow_char_buf_ = CharBuffer.allocate(char_buf.remaining() + 1);
// Copy the characters over to the underflow_char_buf_. Note that
// calling underflow_char_buf_.append(char_buf) is not correct because
// it does not properly advance the position of char_buf.
while (char_buf.hasRemaining()) {
underflow_char_buf_.put(char_buf.get());