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

Method exhaust

guava/src/com/google/common/io/CharStreams.java:250–260  ·  view source on GitHub ↗

Reads and discards data from the given {@code Readable} until the end of the stream is reached. Returns the total number of chars read. Does not close the stream. @since 20.0

(Readable readable)

Source from the content-addressed store, hash-verified

248 * @since 20.0
249 */
250 @CanIgnoreReturnValue
251 public static long exhaust(Readable readable) throws IOException {
252 long total = 0;
253 long read;
254 CharBuffer buf = createBuffer();
255 while ((read = readable.read(buf)) != -1) {
256 total += read;
257 Java8Compatibility.clear(buf);
258 }
259 return total;
260 }
261
262 /**
263 * Discards {@code n} characters of data from the reader. This method will block until the full

Callers 2

testExhaust_readerMethod · 0.95
testExhaust_readableMethod · 0.95

Calls 3

createBufferMethod · 0.95
clearMethod · 0.95
readMethod · 0.45

Tested by 2

testExhaust_readerMethod · 0.76
testExhaust_readableMethod · 0.76