@Override
  public synchronized int available() throws IOException {
    checkNotClosed();
    if (finished) {
      return 0;
    }
    long available = Math.max(file.size() - pos, 0);
    return Ints.saturatedCast(available);
  }
{@link InputStream} for reading from a file's {@link RegularFile}.

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