private static CharBuffer grow ( CharBuffer buf ) { char [ ] copy = Arrays . copyOf ( buf . array ( ) , buf . capacity ( ) * 2 ) ; CharBuffer bigger = CharBuffer . wrap ( copy ) ; bigger . position ( buf . position ( ) ) ; bigger . limit ( buf . limit ( ) ) ; return bigger ; }
Returns a new CharBuffer identical to buf except twice the capacity .