Returns a new CharBuffer identical to buf, except twice the capacity.
(CharBuffer buf)
| 192 | |
| 193 | /** Returns a new CharBuffer identical to buf, except twice the capacity. */ |
| 194 | private static CharBuffer grow(CharBuffer buf) { |
| 195 | char[] copy = Arrays.copyOf(buf.array(), buf.capacity() * 2); |
| 196 | CharBuffer bigger = CharBuffer.wrap(copy); |
| 197 | Java8Compatibility.position(bigger, buf.position()); |
| 198 | Java8Compatibility.limit(bigger, buf.limit()); |
| 199 | return bigger; |
| 200 | } |
| 201 | |
| 202 | /** Handle the case of underflow caused by needing more input characters. */ |
| 203 | private void readMoreChars() throws IOException { |