Reads and discards data from the given 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)
| 167 | */ |
| 168 | |
| 169 | @CanIgnoreReturnValue |
| 170 | public static long exhaust(Readable readable) throws IOException { |
| 171 | long total = 0; |
| 172 | long read; |
| 173 | CharBuffer buf = createBuffer(); |
| 174 | while ((read = readable.read(buf)) != -1) { |
| 175 | total += read; |
| 176 | buf.clear(); |
| 177 | } |
| 178 | return total; |
| 179 | } |
| 180 | |
| 181 | /** |
| 182 | * Discards {@code n} characters of data from the reader. This method will block until the full |
nothing calls this directly
no test coverage detected