private long skipByReading ( final long n ) throws IOException { long toSkip = n ; int len ; while ( toSkip > 0 ) { len = is . read ( buffer , 0 , ( int ) Math . min ( buffer . length , toSkip ) ) ; if ( len > 0 ) toSkip -= len ; else break ; } return n - toSkip ; }
Skips the given amount of bytes by repeated reads .