org.archive.io
Class DiskByteQueue.FlipFileInputStream

java.lang.Object
  extended by java.io.InputStream
      extended by org.archive.io.DiskByteQueue.FlipFileInputStream
All Implemented Interfaces:
java.io.Closeable
Enclosing class:
DiskByteQueue

public class DiskByteQueue.FlipFileInputStream
extends java.io.InputStream

An input stream that supports the DiskBackedByteQueue, by always reading from the current inFile, and triggering a "flip" when one inFile is exhausted.

Author:
Gordon Mohr.

Field Summary
(package private)  java.io.FileInputStream fileStream
           
(package private)  java.io.InputStream inStream
           
(package private)  long position
           
 
Constructor Summary
DiskByteQueue.FlipFileInputStream(long readPosition)
          Constructor.
 
Method Summary
 void close()
          (non-Javadoc)
 long getReadPosition()
          Returns the current position of the input stream in the current file (since last flip).
 int read()
          (non-Javadoc)
 int read(byte[] b)
          (non-Javadoc)
 int read(byte[] b, int off, int len)
          (non-Javadoc)
 
Methods inherited from class java.io.InputStream
available, mark, markSupported, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileStream

java.io.FileInputStream fileStream

inStream

java.io.InputStream inStream

position

long position
Constructor Detail

DiskByteQueue.FlipFileInputStream

public DiskByteQueue.FlipFileInputStream(long readPosition)
                                  throws java.io.IOException
Constructor.

Parameters:
readPosition -
Throws:
java.io.IOException
Method Detail

read

public int read()
         throws java.io.IOException
(non-Javadoc)

Specified by:
read in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.read()

read

public int read(byte[] b)
         throws java.io.IOException
(non-Javadoc)

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

read

public int read(byte[] b,
                int off,
                int len)
         throws java.io.IOException
(non-Javadoc)

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

close

public void close()
           throws java.io.IOException
(non-Javadoc)

Specified by:
close in interface java.io.Closeable
Overrides:
close in class java.io.InputStream
Throws:
java.io.IOException
See Also:
InputStream.close()

getReadPosition

public long getReadPosition()
Returns the current position of the input stream in the current file (since last flip).

Returns:
number of bytes that have been read from the current file.


Copyright © 2003-2005 Internet Archive. All Rights Reserved.