Attempts to skip up to n bytes from the given input stream, but not more than in.available() bytes. This prevents FileInputStream from skipping more bytes than actually remain in the file, something that it plain FileInputStream#skip(long) specifies it can do in its Ja
(InputStream in, long n)
| 827 | |
| 828 | |
| 829 | private static long skipSafely(InputStream in, long n) throws IOException { |
| 830 | int available = in.available(); |
| 831 | return available == 0 ? 0 : in.skip(Math.min(available, n)); |
| 832 | } |
| 833 | |
| 834 | /** |
| 835 | * Process the bytes of the given input stream using the given processor. |