class RandomAccessFileInputStream extends InputStream {

  @Override
  public int available() throws IOException {
    long rangeRelativePosition = raf.getFilePointer() - rangeOffset;
    long result = rangeLength - rangeRelativePosition;
    if (result > Integer.MAX_VALUE) {
      return Integer.MAX_VALUE;
    }
    return (int) result;
  }

  public  RandomAccessFileInputStream(File file);
  public  RandomAccessFileInputStream(File file, long rangeOffset, long rangeLength);

}