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 aFileInputStream
but opens the file by the first file access.
-
-
Constructor Summary
Constructors Constructor Description LazyFileInputStream(File file)
Creates a newLazyFileInputStream
for the given file.LazyFileInputStream(FileDescriptor fdObj)
Creates a newLazyFileInputStream
for the given file desciptor.LazyFileInputStream(String name)
Creates a newLazyFileInputStream
for the given file.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
close()
void
mark(int readlimit)
boolean
markSupported()
void
open()
Opens the underlying file input stream in neccessairy.int
read()
int
read(byte[] b)
int
read(byte[] b, int off, int len)
void
reset()
long
skip(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 newLazyFileInputStream
for the given file. If the file is unreadably, a FileNotFoundException is thrown.- Parameters:
file
-- Throws:
FileNotFoundException
-
LazyFileInputStream
public LazyFileInputStream(FileDescriptor fdObj)
Creates a newLazyFileInputStream
for the given file desciptor.- Parameters:
fdObj
-
-
LazyFileInputStream
public LazyFileInputStream(String name) throws FileNotFoundException
Creates a newLazyFileInputStream
for the given file. If the file is unreadably, a FileNotFoundException is thrown.- Parameters:
name
-- Throws:
FileNotFoundException
-
-
Method Detail
-
open
public void open() throws IOException
Opens the underlying file input stream in neccessairy.- Throws:
IOException
-
read
public int read() throws IOException
- Specified by:
read
in classInputStream
- Throws:
IOException
-
available
public int available() throws IOException
- Overrides:
available
in classInputStream
- Throws:
IOException
-
close
public void close() throws IOException
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Overrides:
close
in classInputStream
- Throws:
IOException
-
reset
public void reset() throws IOException
- Overrides:
reset
in classInputStream
- Throws:
IOException
-
markSupported
public boolean markSupported()
- Overrides:
markSupported
in classInputStream
-
mark
public void mark(int readlimit)
- Overrides:
mark
in classInputStream
-
skip
public long skip(long n) throws IOException
- Overrides:
skip
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
read
public int read(byte[] b, int off, int len) throws IOException
- Overrides:
read
in classInputStream
- Throws:
IOException
-
-