org.eclipse.osgi.framework.internal.reliablefile
Class ReliableFileInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by java.io.FilterInputStream
          extended by org.eclipse.osgi.framework.internal.reliablefile.ReliableFileInputStream
All Implemented Interfaces:
java.io.Closeable

public class ReliableFileInputStream
extends java.io.FilterInputStream

A ReliableFile FileInputStream replacement class. This class can be used just like FileInputStream. The class is in partnership with ReliableFileOutputStream to avoid losing file data by using multiple files.

See Also:
ReliableFileOutputStream

Field Summary
 
Fields inherited from class java.io.FilterInputStream
in
 
Constructor Summary
ReliableFileInputStream(java.io.File file)
          Constructs a new ReliableFileInputStream on the File file.
ReliableFileInputStream(java.io.File file, int generation, int openMask)
          Constructs a new ReliableFileInputStream on the File file.
ReliableFileInputStream(java.lang.String name)
          Constructs a new ReliableFileInputStream on the file named name.
 
Method Summary
 int available()
          Override default available method.
 void close()
          Closes this input stream and releases any system resources associated with the stream.
 void mark(int readlimit)
          Override default mark method.
 boolean markSupported()
          Override default markSupported method.
 int read()
          Override default FilterInputStream method.
 int read(byte[] b)
          Override default FilterInputStream method.
 int read(byte[] b, int off, int len)
          Override default FilterInputStream method.
 void reset()
          Override default reset method.
 long skip(long n)
          Override default skip method.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReliableFileInputStream

public ReliableFileInputStream(java.lang.String name)
                        throws java.io.IOException
Constructs a new ReliableFileInputStream on the file named name. If the file does not exist, the FileNotFoundException is thrown. The name may be absolute or relative to the System property "user.dir".

Parameters:
name - the file on which to stream reads.
Throws:
java.io.IOException - If an error occurs opening the file.

ReliableFileInputStream

public ReliableFileInputStream(java.io.File file)
                        throws java.io.IOException
Constructs a new ReliableFileInputStream on the File file. If the file does not exist, the FileNotFoundException is thrown.

Parameters:
file - the File on which to stream reads.
Throws:
java.io.IOException - If an error occurs opening the file.

ReliableFileInputStream

public ReliableFileInputStream(java.io.File file,
                               int generation,
                               int openMask)
                        throws java.io.IOException
Constructs a new ReliableFileInputStream on the File file. If the file does not exist, the FileNotFoundException is thrown.

Parameters:
file - the File on which to stream reads.
generation - a specific generation requested.
openMask - mask used to open data. are invalid (corrupt, missing, etc).
Throws:
java.io.IOException - If an error occurs opening the file.
Method Detail

close

public void close()
           throws java.io.IOException
Closes this input stream and releases any system resources associated with the stream.

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.FilterInputStream
Throws:
java.io.IOException - If an error occurs closing the file.

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
Override default FilterInputStream method.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException
See Also:
FilterInputStream.read(byte[], int, int)

read

public int read(byte[] b)
         throws java.io.IOException
Override default FilterInputStream method.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException
See Also:
FilterInputStream.read(byte[])

read

public int read()
         throws java.io.IOException
Override default FilterInputStream method.

Overrides:
read in class java.io.FilterInputStream
Throws:
java.io.IOException
See Also:
FilterInputStream.read()

available

public int available()
              throws java.io.IOException
Override default available method.

Overrides:
available in class java.io.FilterInputStream
Throws:
java.io.IOException
See Also:
FilterInputStream.available()

skip

public long skip(long n)
          throws java.io.IOException
Override default skip method.

Overrides:
skip in class java.io.FilterInputStream
Throws:
java.io.IOException
See Also:
FilterInputStream.skip(long)

markSupported

public boolean markSupported()
Override default markSupported method.

Overrides:
markSupported in class java.io.FilterInputStream
See Also:
FilterInputStream.markSupported()

mark

public void mark(int readlimit)
Override default mark method.

Overrides:
mark in class java.io.FilterInputStream
See Also:
FilterInputStream.mark(int)

reset

public void reset()
           throws java.io.IOException
Override default reset method.

Overrides:
reset in class java.io.FilterInputStream
Throws:
java.io.IOException
See Also:
FilterInputStream.reset()


Copyright © 2007-2012 FuseSource, Corp.. All Rights Reserved.