public static void skipFully(InputStream in,long bytes) throws IOException {
  if (bytes < 0) {
    throw new IllegalArgumentException("Can't skip " + bytes + " bytes");
  }
  long remaining=bytes;
  while (remaining > 0) {
    long skipped=in.skip(remaining);
    if (skipped <= 0) {
      throw new EOFException("Reached EOF while trying to skip a total of " + bytes);
    }
    remaining-=skipped;
  }
}

public static void skipFully ( InputStream in , long bytes ) throws IOException { if ( bytes < 0 ) { throw new IllegalArgumentException ( "Can't skip " + bytes + " bytes" ) ; } long remaining = bytes ; while ( remaining > 0 ) { long skipped = in . skip ( remaining ) ; if ( skipped <= 0 ) { throw new EOFException ( "Reached EOF while trying to skip a total of " + bytes ) ; } remaining -= skipped ; } }
provide a skip fully method . either skips the requested number of bytes or throws an ioexception ;
