gate.creole.annic.apache.lucene.index
Class CompoundFileReader.CSInputStream

java.lang.Object
  extended by gate.creole.annic.apache.lucene.store.InputStream
      extended by gate.creole.annic.apache.lucene.index.CompoundFileReader.CSInputStream
All Implemented Interfaces:
Cloneable
Enclosing class:
CompoundFileReader

static final class CompoundFileReader.CSInputStream
extends InputStream

Implementation of an InputStream that reads from a portion of the compound file. The visibility is left as "package" *only* because this helps with testing since JUnit test cases in a different class can then access package fields of this class.


Field Summary
(package private)  InputStream base
           
(package private)  long fileOffset
           
 
Fields inherited from class gate.creole.annic.apache.lucene.store.InputStream
length
 
Constructor Summary
CompoundFileReader.CSInputStream(InputStream base, long fileOffset, long length)
           
 
Method Summary
 void close()
          Closes the stream to futher operations.
protected  void readInternal(byte[] b, int offset, int len)
          Expert: implements buffer refill.
protected  void seekInternal(long pos)
          Expert: implements seek.
 
Methods inherited from class gate.creole.annic.apache.lucene.store.InputStream
clone, getFilePointer, length, readByte, readBytes, readChars, readInt, readLong, readString, readVInt, readVLong, seek
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

base

InputStream base

fileOffset

long fileOffset
Constructor Detail

CompoundFileReader.CSInputStream

CompoundFileReader.CSInputStream(InputStream base,
                                 long fileOffset,
                                 long length)
                           throws IOException
Throws:
IOException
Method Detail

readInternal

protected void readInternal(byte[] b,
                            int offset,
                            int len)
                     throws IOException
Expert: implements buffer refill. Reads bytes from the current position in the input.

Specified by:
readInternal in class InputStream
Parameters:
b - the array to read bytes into
offset - the offset in the array to start storing bytes
length - the number of bytes to read
Throws:
IOException

seekInternal

protected void seekInternal(long pos)
                     throws IOException
Expert: implements seek. Sets current position in this file, where the next readInternal(byte[],int,int) will occur.

Specified by:
seekInternal in class InputStream
Throws:
IOException
See Also:
readInternal(byte[],int,int)

close

public void close()
           throws IOException
Closes the stream to futher operations.

Specified by:
close in class InputStream
Throws:
IOException