org.apache.jackrabbit.util
Class LazyFileInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.apache.jackrabbit.util.LazyFileInputStream
All Implemented Interfaces:
Closeable

public class LazyFileInputStream
extends InputStream

This Class implements an InputStream that provides the same functionality as a FileInputStream but opens the file by the first file access.


Constructor Summary
LazyFileInputStream(File file)
          Creates a new LazyFileInputStream for the given file.
LazyFileInputStream(FileDescriptor fdObj)
          Creates a new LazyFileInputStream for the given file desciptor.
LazyFileInputStream(String name)
          Creates a new LazyFileInputStream for the given file.
 
Method Summary
 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.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LazyFileInputStream

public LazyFileInputStream(File file)
                    throws FileNotFoundException
Creates a new LazyFileInputStream for the given file. If the file is unreadably, a FileNotFoundException is thrown.

Parameters:
file -
Throws:
FileNotFoundException

LazyFileInputStream

public LazyFileInputStream(FileDescriptor fdObj)
Creates a new LazyFileInputStream for the given file desciptor.

Parameters:
fdObj -

LazyFileInputStream

public LazyFileInputStream(String name)
                    throws FileNotFoundException
Creates a new LazyFileInputStream 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 class InputStream
Throws:
IOException

available

public int available()
              throws IOException

Overrides:
available in class InputStream
Throws:
IOException

close

public void close()
           throws IOException

Specified by:
close in interface Closeable
Overrides:
close in class InputStream
Throws:
IOException

reset

public void reset()
           throws IOException

Overrides:
reset in class InputStream
Throws:
IOException

markSupported

public boolean markSupported()

Overrides:
markSupported in class InputStream

mark

public void mark(int readlimit)

Overrides:
mark in class InputStream

skip

public long skip(long n)
          throws IOException

Overrides:
skip in class InputStream
Throws:
IOException

read

public int read(byte[] b)
         throws IOException

Overrides:
read in class InputStream
Throws:
IOException

read

public int read(byte[] b,
                int off,
                int len)
         throws IOException

Overrides:
read in class InputStream
Throws:
IOException


Copyright © 2004-2010 The Apache Software Foundation. All Rights Reserved.