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)
| 797 | * {@code InputStream.skip()}. |
| 798 | */ |
| 799 | private static long skipSafely(InputStream in, long n) throws IOException { |
| 800 | int available = in.available(); |
| 801 | return available == 0 ? 0 : in.skip(Math.min(available, n)); |
| 802 | } |
| 803 | |
| 804 | /** |
| 805 | * Process the bytes of the given input stream using the given processor. |