Reads and discards data from the given InputStream until the end of the stream is reached. Returns the total number of bytes read. Does not close the stream. @since 20.0
(InputStream in)
| 225 | * @since 20.0 |
| 226 | */ |
| 227 | @CanIgnoreReturnValue |
| 228 | public static long exhaust(InputStream in) throws IOException { |
| 229 | long total = 0; |
| 230 | long read; |
| 231 | byte[] buf = createBuffer(); |
| 232 | while ((read = in.read(buf)) != -1) { |
| 233 | total += read; |
| 234 | } |
| 235 | return total; |
| 236 | } |
| 237 | |
| 238 | /** |
| 239 | * Returns a new {@link ByteArrayDataInput} instance to read from the {@code bytes} array from the |
no test coverage detected