private long countBySkipping ( InputStream in ) throws IOException { long count = 0 ; long skipped ; while ( ( skipped = skipUpTo ( in , Integer . MAX_VALUE ) ) > 0 ) { count += skipped ; } return count ; }
Counts the bytes in the given input stream using skip if possible . Returns SKIP_FAILED if the first call to skip threw in which case skip may just not be supported .