Java Code Examples for java.io.FilterInputStream#skip()

The following examples show how to use java.io.FilterInputStream#skip() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestHadoopArchives.java    From hadoop with Apache License 2.0 5 votes vote down vote up
private static long skipUntilZero(final FilterInputStream fis, 
    final long toSkip) throws IOException {
  long skipped = 0;
  long remainsToSkip = toSkip;
  long s;
  while (skipped < toSkip) {
    s = fis.skip(remainsToSkip); // actually skippped
    if (s == 0) {
      return skipped; // EOF or impossible to skip.
    }
    skipped += s; 
    remainsToSkip -= s;
  }
  return skipped;
}
 
Example 2
Source File: TestHadoopArchives.java    From big-c with Apache License 2.0 5 votes vote down vote up
private static long skipUntilZero(final FilterInputStream fis, 
    final long toSkip) throws IOException {
  long skipped = 0;
  long remainsToSkip = toSkip;
  long s;
  while (skipped < toSkip) {
    s = fis.skip(remainsToSkip); // actually skippped
    if (s == 0) {
      return skipped; // EOF or impossible to skip.
    }
    skipped += s; 
    remainsToSkip -= s;
  }
  return skipped;
}