/*
  * original output is full and doesn't have remaining. allocate more space
  * to new CharBuffer and return it, the contents in the given buffer will be
  * copied into the new buffer.
  */
 private java.nio.CharBuffer allocateMore(java.nio.CharBuffer output)
 {
     if (output.capacity() == 0) {
         return java.nio.CharBuffer.allocate(1);
     }
     java.nio.CharBuffer result = java.nio.CharBuffer.allocate(output.capacity() * 2);
     output.flip();
     result.put(output);
     return result;
 }