@Override
  public long skip(long n) throws IOException {
    if (n <= 0) {
      return 0;
    }

    synchronized (this) {
      checkNotClosed();
      if (finished) {
        return 0;
      }

      // available() must be an int, so the min must be also
      int skip = (int) Math.min(Math.max(file.size() - pos, 0), n);
      pos += skip;
      return skip;
    }
  }
{@link InputStream} for reading from a file's {@link RegularFile}.

@author Colin Decker
jimfs/src/main/java/com/google/common/jimfs/JimfsInputStream.java