public static void skip ( InputStream is , long amount ) throws IOException { long leftToSkip = amount ; long amountSkipped = 0 ; while ( leftToSkip > 0 && amountSkipped >= 0 ) { amountSkipped = is . skip ( leftToSkip ) ; leftToSkip -= amountSkipped ; } }
Ensure InputStream actually skips ahead the required number of bytes