Counts the bytes in the given input stream using skip if possible. Returns SKIP_FAILED if the first call to skip threw, in which case skip may just not be supported.
(InputStream in)
| 235 | */ |
| 236 | |
| 237 | private long countBySkipping(InputStream in) throws IOException { |
| 238 | long count = 0; |
| 239 | long skipped; |
| 240 | while ((skipped = skipUpTo(in, Integer.MAX_VALUE)) > 0) { |
| 241 | count += skipped; |
| 242 | } |
| 243 | return count; |
| 244 | } |
| 245 | |
| 246 | /** |
| 247 | * Copies the contents of this byte source to the given {@code OutputStream}. Does not close |