public class RegionFileInputStream
extends java.io.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(java.io.File file)
Same as
RegionFileInputStream(File, boolean) with inflate set to
false. |
RegionFileInputStream(java.io.File file,
boolean inflate)
Same as
RegionFileInputStream(File, long, long, boolean) where
offset is 0 and len the length of the file. |
RegionFileInputStream(java.io.File file,
long off,
long len)
Creates a new input stream that reads for the region [off, off+len] of
the given file.
|
RegionFileInputStream(java.io.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.
|
java.io.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(java.io.File file) throws java.io.IOException, java.io.FileNotFoundException
RegionFileInputStream(File, boolean)
with inflate set to
false.file
- the file to read from.java.io.FileNotFoundException
- if the file was not foundjava.io.IOException
- if an I/O error occurspublic RegionFileInputStream(java.io.File file, boolean inflate) throws java.io.IOException, java.io.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 compressedjava.io.FileNotFoundException
- if the file was not foundjava.io.IOException
- if an I/O error occurspublic RegionFileInputStream(java.io.File file, long off, long len) throws java.io.IOException, java.io.FileNotFoundException
file
- the file to read from.off
- the absolute offset in the file to read fromlen
- the total length of the regionjava.io.FileNotFoundException
- if the file was not foundjava.io.IOException
- if an I/O error occurspublic RegionFileInputStream(java.io.File file, long off, long len, boolean inflate) throws java.io.FileNotFoundException, java.io.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 compressedjava.io.FileNotFoundException
- if the file was not foundjava.io.IOException
- if an I/O error occurspublic int available() throws java.io.IOException
available
in class java.io.InputStream
java.io.IOException
public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class java.io.InputStream
java.io.IOException
public void reset() throws java.io.IOException
reset
in class java.io.InputStream
java.io.IOException
public boolean markSupported()
markSupported
in class java.io.InputStream
public void mark(int readlimit)
mark
in class java.io.InputStream
public long skip(long n) throws java.io.IOException
skip
in class java.io.InputStream
java.io.IOException
public int read() throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public int read(byte[] b, int off, int len) throws java.io.IOException
read
in class java.io.InputStream
java.io.IOException
public java.io.File getFile()
public long getAbsolutePosition() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.public long getPosition() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.public long getRemaining() throws java.io.IOException
java.io.IOException
- if an I/O error occurs.public RegionFileInputStream substream(long off, long len) throws java.io.IOException
off
- relative offset to the current read pointer of this regionlen
- total length of this new stream.java.io.IOException
- if an I/O error occurs.public RegionFileInputStream duplicate() throws java.io.IOException
null
is returned.null
java.io.IOException
- if an I/O error occurs."Copyright © 2010 - 2020 Adobe Systems Incorporated. All Rights Reserved"