Package org.apache.jackrabbit.util
Class LazyFileInputStream
- java.lang.Object
-
- java.io.InputStream
-
- org.apache.jackrabbit.util.LazyFileInputStream
-
- All Implemented Interfaces:
Closeable,AutoCloseable
public class LazyFileInputStream extends InputStream
This Class implements an InputStream that provides the same functionality as aFileInputStreambut opens the file by the first file access.
-
-
Constructor Summary
Constructors Constructor Description LazyFileInputStream(File file)Creates a newLazyFileInputStreamfor the given file.LazyFileInputStream(FileDescriptor fdObj)Creates a newLazyFileInputStreamfor the given file desciptor.LazyFileInputStream(String name)Creates a newLazyFileInputStreamfor the given file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intavailable()voidclose()voidmark(int readlimit)booleanmarkSupported()voidopen()Opens the underlying file input stream in neccessairy.intread()intread(byte[] b)intread(byte[] b, int off, int len)voidreset()longskip(long n)-
Methods inherited from class java.io.InputStream
nullInputStream, readAllBytes, readNBytes, readNBytes, transferTo
-
-
-
-
Constructor Detail
-
LazyFileInputStream
public LazyFileInputStream(File file) throws FileNotFoundException
Creates a newLazyFileInputStreamfor the given file. If the file is unreadably, a FileNotFoundException is thrown.- Parameters:
file-- Throws:
FileNotFoundException
-
LazyFileInputStream
public LazyFileInputStream(FileDescriptor fdObj)
Creates a newLazyFileInputStreamfor the given file desciptor.- Parameters:
fdObj-
-
LazyFileInputStream
public LazyFileInputStream(String name) throws FileNotFoundException
Creates a newLazyFileInputStreamfor the given file. If the file is unreadably, a FileNotFoundException is thrown.- Parameters:
name-- Throws:
FileNotFoundException
-
-
Method Detail
-
open
public void open() throws IOExceptionOpens the underlying file input stream in neccessairy.- Throws:
IOException
-
read
public int read() throws IOException- Specified by:
readin classInputStream- Throws:
IOException
-
available
public int available() throws IOException- Overrides:
availablein classInputStream- Throws:
IOException
-
close
public void close() throws IOException- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classInputStream- Throws:
IOException
-
reset
public void reset() throws IOException- Overrides:
resetin classInputStream- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupportedin classInputStream
-
mark
public void mark(int readlimit)
- Overrides:
markin classInputStream
-
skip
public long skip(long n) throws IOException- Overrides:
skipin classInputStream- Throws:
IOException
-
read
public int read(byte[] b) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException- Overrides:
readin classInputStream- Throws:
IOException
-
-