org.apache.lucene.store
Class IndexInput

java.lang.Object
  extended by org.apache.lucene.store.DataInput
      extended by org.apache.lucene.store.IndexInput
All Implemented Interfaces:
Closeable, Cloneable
Direct Known Subclasses:
BufferedIndexInput, ChecksumIndexInput, RAMInputStream

public abstract class IndexInput
extends DataInput
implements Cloneable, Closeable

Abstract base class for input from a file in a Directory. A random-access input stream. Used for all Lucene index input operations.

See Also:
Directory

Constructor Summary
protected IndexInput(String resourceDescription)
          resourceDescription should be a non-null, opaque string describing this resource; it's returned from toString().
 
Method Summary
abstract  void close()
          Closes the stream to further operations.
 void copyBytes(IndexOutput out, long numBytes)
          Copies numBytes bytes to the given IndexOutput.
abstract  long getFilePointer()
          Returns the current position in this file, where the next read will occur.
abstract  long length()
          The number of bytes in the file.
abstract  void seek(long pos)
          Sets current position in this file, where the next read will occur.
 String toString()
           
 
Methods inherited from class org.apache.lucene.store.DataInput
clone, readByte, readBytes, readBytes, readInt, readLong, readShort, readString, readStringSet, readStringStringMap, readVInt, readVLong
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

IndexInput

protected IndexInput(String resourceDescription)
resourceDescription should be a non-null, opaque string describing this resource; it's returned from toString().

Method Detail

close

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

Specified by:
close in interface Closeable
Throws:
IOException

getFilePointer

public abstract long getFilePointer()
Returns the current position in this file, where the next read will occur.

See Also:
seek(long)

seek

public abstract void seek(long pos)
                   throws IOException
Sets current position in this file, where the next read will occur.

Throws:
IOException
See Also:
getFilePointer()

length

public abstract long length()
The number of bytes in the file.


copyBytes

public void copyBytes(IndexOutput out,
                      long numBytes)
               throws IOException
Copies numBytes bytes to the given IndexOutput.

NOTE: this method uses an intermediate buffer to copy the bytes. Consider overriding it in your implementation, if you can make a better, optimized copy.

NOTE ensure that there are enough bytes in the input to copy to output. Otherwise, different exceptions may be thrown, depending on the implementation.

Throws:
IOException

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2000-2012 Apache Software Foundation. All Rights Reserved.