Attempts to skip up to {@code n} bytes from the given input stream, but not more than {@code in.available()} bytes. This prevents {@code FileInputStream} from skipping more bytes than actually remain in the file, something that it {@linkplain 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. |