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 java.io.FileInputStream#skip(long) specifies it can do i
(InputStream in, long n)
| 877 | * {@code InputStream.skip()}. |
| 878 | */ |
| 879 | private static long skipSafely(InputStream in, long n) throws IOException { |
| 880 | int available = in.available(); |
| 881 | return available == 0 ? 0 : in.skip(min(available, n)); |
| 882 | } |
| 883 | |
| 884 | /** |
| 885 | * Process the bytes of the given input stream using the given processor. |