MCPcopy
hub / github.com/google/guava / grow

Method grow

guava/src/com/google/common/io/ReaderInputStream.java:194–200  ·  view source on GitHub ↗

Returns a new CharBuffer identical to buf, except twice the capacity.

(CharBuffer buf)

Source from the content-addressed store, hash-verified

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 {

Callers 1

readMoreCharsMethod · 0.95

Calls 6

positionMethod · 0.95
limitMethod · 0.95
copyOfMethod · 0.45
capacityMethod · 0.45
wrapMethod · 0.45
limitMethod · 0.45

Tested by

no test coverage detected