|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.io.InputStream
java.io.FilterInputStream
org.apache.commons.io.input.ProxyInputStream
org.apache.commons.io.input.AutoCloseInputStream
org.apache.jackrabbit.core.data.LazyFileInputStream
public class LazyFileInputStream
This input stream delays opening the file until the first byte is read, and closes and discards the underlying stream as soon as the end of input has been reached or when the stream is explicitly closed.
Field Summary | |
---|---|
protected FileDescriptor |
fd
The file descriptor to use. |
protected File |
file
The file to read from. |
protected boolean |
opened
True if the input stream was opened. |
Fields inherited from class java.io.FilterInputStream |
---|
in |
Constructor Summary | |
---|---|
LazyFileInputStream(File file)
Creates a new LazyFileInputStream for the given file. |
|
LazyFileInputStream(FileDescriptor fd)
Creates a new LazyFileInputStream for the given file
descriptor. |
|
LazyFileInputStream(String name)
Creates a new LazyFileInputStream for the given file. |
Method Summary | |
---|---|
int |
available()
|
void |
close()
|
void |
mark(int readlimit)
|
boolean |
markSupported()
|
protected void |
open()
Open the stream if required. |
int |
read()
|
int |
read(byte[] b)
|
int |
read(byte[] b,
int off,
int len)
|
void |
reset()
|
long |
skip(long n)
|
Methods inherited from class org.apache.commons.io.input.AutoCloseInputStream |
---|
finalize |
Methods inherited from class java.lang.Object |
---|
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final FileDescriptor fd
protected final File file
protected boolean opened
Constructor Detail |
---|
public LazyFileInputStream(File file) throws FileNotFoundException
LazyFileInputStream
for the given file. If the
file is unreadable, a FileNotFoundException is thrown.
The file is not opened until the first byte is read from the stream.
file
- the file
FileNotFoundException
public LazyFileInputStream(FileDescriptor fd)
LazyFileInputStream
for the given file
descriptor.
The file is not opened until the first byte is read from the stream.
fdObj
- public LazyFileInputStream(String name) throws FileNotFoundException
LazyFileInputStream
for the given file. If the
file is unreadable, a FileNotFoundException is thrown.
name
-
FileNotFoundException
Method Detail |
---|
protected void open() throws IOException
IOException
public int read() throws IOException
read
in class org.apache.commons.io.input.AutoCloseInputStream
IOException
public int available() throws IOException
available
in class org.apache.commons.io.input.ProxyInputStream
IOException
public void close() throws IOException
close
in interface Closeable
close
in class org.apache.commons.io.input.AutoCloseInputStream
IOException
public void reset() throws IOException
reset
in class org.apache.commons.io.input.ProxyInputStream
IOException
public boolean markSupported()
markSupported
in class org.apache.commons.io.input.ProxyInputStream
public void mark(int readlimit)
mark
in class org.apache.commons.io.input.ProxyInputStream
public long skip(long n) throws IOException
skip
in class org.apache.commons.io.input.ProxyInputStream
IOException
public int read(byte[] b) throws IOException
read
in class org.apache.commons.io.input.AutoCloseInputStream
IOException
public int read(byte[] b, int off, int len) throws IOException
read
in class org.apache.commons.io.input.AutoCloseInputStream
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |