@Test(expected = IllegalArgumentException.class) public void testSetRange_LongOverflow() throws IOException { stream.setRange(Long.MAX_VALUE, 1); }
public void setRange(long rangeOffset, long rangeLength) throws IOException { if (rangeOffset < 0) { throw new IllegalArgumentException("rangeOffset must be >= 0"); } if (rangeLength < 0) { throw new IllegalArgumentException("rangeLength must be >= 0"); } if (rangeOffset + rangeLength > fileLength) { throw new IllegalArgumentException("Read range exceeds file length"); } if (rangeOffset + rangeLength < 0) { throw new IllegalArgumentException("Insane input size not supported"); } this.rangeOffset = rangeOffset; this.rangeLength = rangeLength; mark = rangeOffset; reset(); mark = -1; }
RandomAccessFileInputStream extends InputStream { public void setRange(long rangeOffset, long rangeLength) throws IOException { if (rangeOffset < 0) { throw new IllegalArgumentException("rangeOffset must be >= 0"); } if (rangeLength < 0) { throw new IllegalArgumentException("rangeLength must be >= 0"); } if (rangeOffset + rangeLength > fileLength) { throw new IllegalArgumentException("Read range exceeds file length"); } if (rangeOffset + rangeLength < 0) { throw new IllegalArgumentException("Insane input size not supported"); } this.rangeOffset = rangeOffset; this.rangeLength = rangeLength; mark = rangeOffset; reset(); mark = -1; } }
RandomAccessFileInputStream extends InputStream { public void setRange(long rangeOffset, long rangeLength) throws IOException { if (rangeOffset < 0) { throw new IllegalArgumentException("rangeOffset must be >= 0"); } if (rangeLength < 0) { throw new IllegalArgumentException("rangeLength must be >= 0"); } if (rangeOffset + rangeLength > fileLength) { throw new IllegalArgumentException("Read range exceeds file length"); } if (rangeOffset + rangeLength < 0) { throw new IllegalArgumentException("Insane input size not supported"); } this.rangeOffset = rangeOffset; this.rangeLength = rangeLength; mark = rangeOffset; reset(); mark = -1; } RandomAccessFileInputStream(File file);  RandomAccessFileInputStream(File file, long rangeOffset, long rangeLength); }
RandomAccessFileInputStream extends InputStream { public void setRange(long rangeOffset, long rangeLength) throws IOException { if (rangeOffset < 0) { throw new IllegalArgumentException("rangeOffset must be >= 0"); } if (rangeLength < 0) { throw new IllegalArgumentException("rangeLength must be >= 0"); } if (rangeOffset + rangeLength > fileLength) { throw new IllegalArgumentException("Read range exceeds file length"); } if (rangeOffset + rangeLength < 0) { throw new IllegalArgumentException("Insane input size not supported"); } this.rangeOffset = rangeOffset; this.rangeLength = rangeLength; mark = rangeOffset; reset(); mark = -1; } RandomAccessFileInputStream(File file);  RandomAccessFileInputStream(File file, long rangeOffset, long rangeLength); void setRange(long rangeOffset, long rangeLength); @Override int available(); long getPosition(); @Override void close(); @Override int read(); @Override int read(byte[] b, int off, int len); @Override int read(byte[] b); @Override long skip(long n); @Override boolean markSupported(); @Override void mark(int readlimit); @Override void reset(); long length(); }
RandomAccessFileInputStream extends InputStream { public void setRange(long rangeOffset, long rangeLength) throws IOException { if (rangeOffset < 0) { throw new IllegalArgumentException("rangeOffset must be >= 0"); } if (rangeLength < 0) { throw new IllegalArgumentException("rangeLength must be >= 0"); } if (rangeOffset + rangeLength > fileLength) { throw new IllegalArgumentException("Read range exceeds file length"); } if (rangeOffset + rangeLength < 0) { throw new IllegalArgumentException("Insane input size not supported"); } this.rangeOffset = rangeOffset; this.rangeLength = rangeLength; mark = rangeOffset; reset(); mark = -1; } RandomAccessFileInputStream(File file);  RandomAccessFileInputStream(File file, long rangeOffset, long rangeLength); void setRange(long rangeOffset, long rangeLength); @Override int available(); long getPosition(); @Override void close(); @Override int read(); @Override int read(byte[] b, int off, int len); @Override int read(byte[] b); @Override long skip(long n); @Override boolean markSupported(); @Override void mark(int readlimit); @Override void reset(); long length();  }