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
opened 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()
Returns 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 InputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class InputStream
IOException
public void reset() throws IOException
reset
in class InputStream
IOException
public boolean markSupported()
markSupported
in class InputStream
public void mark(int readlimit)
mark
in class InputStream
public long skip(long n) throws IOException
skip
in class InputStream
IOException
public int read() throws IOException
read
in class InputStream
IOException
public int read(byte[] b) throws IOException
read
in class InputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class InputStream
IOException
public 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.null
IOException
- if an I/O error occurs."Copyright © 2006 - 2015 Adobe Systems Incorporated. All Rights Reserved"