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)
| 159 | * @since 20.0 |
| 160 | */ |
| 161 | @CanIgnoreReturnValue |
| 162 | public static long exhaust(Readable readable) throws IOException { |
| 163 | long total = 0; |
| 164 | long read; |
| 165 | CharBuffer buf = createBuffer(); |
| 166 | while ((read = readable.read(buf)) != -1) { |
| 167 | total += read; |
| 168 | buf.clear(); |
| 169 | } |
| 170 | return total; |
| 171 | } |
| 172 | |
| 173 | /** |
| 174 | * Discards {@code n} characters of data from the reader. This method will block until the full |
nothing calls this directly
no test coverage detected