/** * 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 */ @CanIgnoreReturnValue public static long exhaust(Readable readable) throws IOException { long total = 0; long read; CharBuffer buf = createBuffer(); while ((read = readable.read(buf)) != -1) { total += read; buf.clear(); } return total; }
checkNotNull(to); long total = 0; CharBuffer buf = createBuffer(); while (from.read(buf) != -1) { buf.flip();
/** * 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 */ @CanIgnoreReturnValue public static long exhaust(Readable readable) throws IOException { long total = 0; long read; CharBuffer buf = createBuffer(); while ((read = readable.read(buf)) != -1) { total += read; buf.clear(); } return total; }
/** * 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 */ @CanIgnoreReturnValue public static long exhaust(Readable readable) throws IOException { long total = 0; long read; CharBuffer buf = createBuffer(); while ((read = readable.read(buf)) != -1) { total += read; buf.clear(); } return total; }
checkNotNull(to); long total = 0; CharBuffer buf = createBuffer(); while (from.read(buf) != -1) { buf.flip();
checkNotNull(to); long total = 0; CharBuffer buf = createBuffer(); while (from.read(buf) != -1) { buf.flip();
/** * 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 */ @CanIgnoreReturnValue public static long exhaust(Readable readable) throws IOException { long total = 0; long read; CharBuffer buf = createBuffer(); while ((read = readable.read(buf)) != -1) { total += read; buf.clear(); } return total; }
/** * 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 */ @CanIgnoreReturnValue public static long exhaust(Readable readable) throws IOException { long total = 0; long read; CharBuffer buf = createBuffer(); while ((read = readable.read(buf)) != -1) { total += read; buf.clear(); } return total; }
@Override long copy(Readable from, Appendable to) throws IOException { CharBuffer buf = CharStreams.createBuffer(); long total = 0; while (from.read(buf) != -1) { buf.flip(); to.append(buf); total += buf.remaining(); buf.clear(); } return total; } },
checkNotNull(to); long total = 0; CharBuffer buf = createBuffer(); while (from.read(buf) != -1) { buf.flip();
checkNotNull(to); long total = 0; CharBuffer buf = createBuffer(); while (from.read(buf) != -1) { buf.flip();