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)
| 233 | */ |
| 234 | |
| 235 | @CanIgnoreReturnValue |
| 236 | public static long exhaust(InputStream in) throws IOException { |
| 237 | long total = 0; |
| 238 | long read; |
| 239 | byte[] buf = createBuffer(); |
| 240 | while ((read = in.read(buf)) != -1) { |
| 241 | total += read; |
| 242 | } |
| 243 | return total; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Returns a new {@link ByteArrayDataInput} instance to read from the {@code bytes} array from the |
no test coverage detected