Counts the bytes in the given input stream using skip if possible.
(InputStream in)
| 230 | |
| 231 | /** Counts the bytes in the given input stream using skip if possible. */ |
| 232 | private static long countBySkipping(InputStream in) throws IOException { |
| 233 | long count = 0; |
| 234 | long skipped; |
| 235 | while ((skipped = skipUpTo(in, Integer.MAX_VALUE)) > 0) { |
| 236 | count += skipped; |
| 237 | } |
| 238 | return count; |
| 239 | } |
| 240 | |
| 241 | /** |
| 242 | * Copies the contents of this byte source to the given {@code OutputStream}. Does not close |