org.apache.lucene.store

Class IndexInput

    • 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

      • 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. If this is beyond the end of the file then this will throw EOFException and then the stream is in an undetermined state.
        Throws:
        IOException
        See Also:
        getFilePointer()
      • length

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

        public IndexInput clone()
        Returns a clone of this stream.

        Clones of a stream access the same data, and are positioned at the same point as the stream they were cloned from.

        Expert: Subclasses must ensure that clones may be positioned at different points in the input from each other and from the stream they were cloned from.

        Warning: Lucene never closes cloned IndexInputs, it will only call close() on the original object.

        If you access the cloned IndexInput after closing the original object, any readXXX methods will throw AlreadyClosedException.

        This method is NOT thread safe, so if the current IndexInput is being used by one thread while clone is called by another, disaster could strike.

        Overrides:
        clone in class DataInput
      • slice

        public abstract IndexInput slice(String sliceDescription,
                                         long offset,
                                         long length)
                                  throws IOException
        Creates a slice of this index input, with the given description, offset, and length. The slice is seeked to the beginning.
        Throws:
        IOException
      • getFullSliceDescription

        protected String getFullSliceDescription(String sliceDescription)
        Subclasses call this to get the String for resourceDescription of a slice of this IndexInput.