Package org.apache.lucene.store
Class IndexInput
- java.lang.Object
-
- org.apache.lucene.store.DataInput
-
- org.apache.lucene.store.IndexInput
-
- All Implemented Interfaces:
Closeable
,AutoCloseable
,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 aDirectory
. A random-access input stream. Used for all Lucene index input operations.- See Also:
Directory
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
IndexInput()
Deprecated.please pass resourceDescriptionprotected
IndexInput(String resourceDescription)
resourceDescription should be a non-null, opaque string describing this resource; it's returned fromtoString()
.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Deprecated Methods Modifier and Type Method Description abstract void
close()
Closes the stream to further operations.void
copyBytes(IndexOutput out, long numBytes)
CopiesnumBytes
bytes to the givenIndexOutput
.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.void
skipChars(int length)
Deprecated.this method operates on old "modified utf8" encoded stringsString
toString()
-
Methods inherited from class org.apache.lucene.store.DataInput
clone, readByte, readBytes, readBytes, readChars, readInt, readLong, readShort, readString, readStringStringMap, readVInt, readVLong, setModifiedUTF8StringsMode
-
-
-
-
Constructor Detail
-
IndexInput
@Deprecated protected IndexInput()
Deprecated.please pass resourceDescription
-
IndexInput
protected IndexInput(String resourceDescription)
resourceDescription should be a non-null, opaque string describing this resource; it's returned fromtoString()
.
-
-
Method Detail
-
skipChars
@Deprecated public void skipChars(int length) throws IOException
Deprecated.this method operates on old "modified utf8" encoded stringsExpert Similar toDataInput.readChars(char[], int, int)
but does not do any conversion operations on the bytes it is reading in. It still has to invokeDataInput.readByte()
just asDataInput.readChars(char[], int, int)
does, but it does not need a buffer to store anything and it does not have to do any of the bitwise operations, since we don't actually care what is in the byte except to determine how many more bytes to read- Parameters:
length
- The number of chars to read- Throws:
IOException
-
close
public abstract void close() throws IOException
Closes the stream to further operations.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- 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
CopiesnumBytes
bytes to the givenIndexOutput
.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
-
-