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)
| 221 | * first call to skip threw, in which case skip may just not be supported. |
| 222 | */ |
| 223 | private long countBySkipping(InputStream in) throws IOException { |
| 224 | long count = 0; |
| 225 | long skipped; |
| 226 | while ((skipped = skipUpTo(in, Integer.MAX_VALUE)) > 0) { |
| 227 | count += skipped; |
| 228 | } |
| 229 | return count; |
| 230 | } |
| 231 | |
| 232 | /** |
| 233 | * Copies the contents of this byte source to the given {@code OutputStream}. Does not close |