public class RegionFileInputStream extends InputStream
RegionFileInputStream implements an input stream that streams
the contents of a region of a file. The reading is buffered. The file is
openend upon the first access. this helps minimizing the total number of
open files.| Constructor and Description |
|---|
RegionFileInputStream(File file)
Same as
RegionFileInputStream(File, boolean) with inflate set to
false. |
RegionFileInputStream(File file,
boolean inflate)
Same as
RegionFileInputStream(File, long, long, boolean) where
offset is 0 and len the length of the file. |
RegionFileInputStream(File file,
long off,
long len)
Creates a new input stream that reads for the region [off, off+len] of
the given file.
|
RegionFileInputStream(File file,
long off,
long len,
boolean inflate)
Creates a new input stream that reads for the region [off, off+len] of
the given file.
|
| Modifier and Type | Method and Description |
|---|---|
int |
available() |
void |
close() |
RegionFileInputStream |
duplicate()
Duplicates this stream.
|
long |
getAbsolutePosition()
Returns the read pointer position relative to this file.
|
File |
getFile()
Retruns the underlying file.
|
long |
getPosition()
Returns the read pointer position relative to this region.
|
long |
getRemaining()
Returns the remaining bytes available in this region
|
void |
mark(int readlimit) |
boolean |
markSupported() |
int |
read() |
int |
read(byte[] b) |
int |
read(byte[] b,
int off,
int len) |
void |
reset() |
long |
skip(long n) |
RegionFileInputStream |
substream(long off,
long len)
Creates a new RegionFileInputStream that is based on this one.
|
public RegionFileInputStream(File file) throws IOException, FileNotFoundException
RegionFileInputStream(File, boolean) with inflate set to
false.file - the file to read from.FileNotFoundException - if the file was not foundIOException - if an I/O error occurspublic RegionFileInputStream(File file, boolean inflate) throws IOException, FileNotFoundException
RegionFileInputStream(File, long, long, boolean) where
offset is 0 and len the length of the file.file - the file to read from.inflate - indicates if the file is compressedFileNotFoundException - if the file was not foundIOException - if an I/O error occurspublic RegionFileInputStream(File file, long off, long len) throws IOException, FileNotFoundException
file - the file to read from.off - the absolute offset in the file to read fromlen - the total length of the regionFileNotFoundException - if the file was not foundIOException - if an I/O error occurspublic RegionFileInputStream(File file, long off, long len, boolean inflate) throws FileNotFoundException, IOException
file - the file to read from.off - the absolute offset in the file to read fromlen - the total length of the regioninflate - indicates if the file is compressedFileNotFoundException - if the file was not foundIOException - if an I/O error occurspublic int available()
throws IOException
available in class InputStreamIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class InputStreamIOExceptionpublic void reset()
throws IOException
reset in class InputStreamIOExceptionpublic boolean markSupported()
markSupported in class InputStreampublic void mark(int readlimit)
mark in class InputStreampublic long skip(long n)
throws IOException
skip in class InputStreamIOExceptionpublic int read()
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b)
throws IOException
read in class InputStreamIOExceptionpublic int read(byte[] b,
int off,
int len)
throws IOException
read in class InputStreamIOExceptionpublic File getFile()
public long getAbsolutePosition()
throws IOException
IOException - if an I/O error occurs.public long getPosition()
throws IOException
IOException - if an I/O error occurs.public long getRemaining()
throws IOException
IOException - if an I/O error occurs.public RegionFileInputStream substream(long off, long len) throws IOException
off - relative offset to the current read pointer of this regionlen - total length of this new stream.IOException - if an I/O error occurs.public RegionFileInputStream duplicate() throws IOException
null is returned.nullIOException - if an I/O error occurs."Copyright © 2010 - 2017 Adobe Systems Incorporated. All Rights Reserved"