| | 421 | |
| | 422 | /** |
| | 423 | * Ensures that the given number of bytes are skipped from the given |
| | 424 | * input stream. |
| | 425 | * @param in the input stream. |
| | 426 | * @param bytes the number of bytes to skip. |
| | 427 | * @throws IOException if the stream does not support seek, |
| | 428 | * or if some other I/O error occurs. |
| | 429 | * @see InputStream#skip |
| | 430 | */ |
| | 431 | public static void skip (InputStream in, int bytes) |
| | 432 | throws IOException |
| | 433 | { |
| | 434 | long remaining = bytes; |
| | 435 | while (remaining != 0) |
| | 436 | { |
| | 437 | final long skipped = in.skip(remaining); |
| | 438 | if (skipped == 0) |
| | 439 | { |
| | 440 | throw new EOFException(); |
| | 441 | } |
| | 442 | remaining -= skipped; |
| | 443 | } |
| | 444 | } |