Module org.apache.lucene.core
Package org.apache.lucene.store
Class BufferedIndexInput.SlicedIndexInput
- java.lang.Object
-
- org.apache.lucene.store.DataInput
-
- org.apache.lucene.store.IndexInput
-
- org.apache.lucene.store.BufferedIndexInput
-
- org.apache.lucene.store.BufferedIndexInput.SlicedIndexInput
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
,java.lang.Cloneable
,RandomAccessInput
- Enclosing class:
- BufferedIndexInput
private static final class BufferedIndexInput.SlicedIndexInput extends BufferedIndexInput
Implementation of an IndexInput that reads from a portion of a file.
-
-
Field Summary
Fields Modifier and Type Field Description (package private) IndexInput
base
(package private) long
fileOffset
(package private) long
length
-
Fields inherited from class org.apache.lucene.store.BufferedIndexInput
BUFFER_SIZE, MERGE_BUFFER_SIZE, MIN_BUFFER_SIZE
-
-
Constructor Summary
Constructors Constructor Description SlicedIndexInput(java.lang.String sliceDescription, IndexInput base, long offset, long length)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description BufferedIndexInput.SlicedIndexInput
clone()
Returns a clone of this stream.void
close()
Closes the stream to further operations.long
length()
The number of bytes in the file.protected void
readInternal(java.nio.ByteBuffer b)
Expert: implements buffer refill.protected void
seekInternal(long pos)
Expert: implements seek.-
Methods inherited from class org.apache.lucene.store.BufferedIndexInput
bufferSize, getBufferSize, getFilePointer, readByte, readByte, readBytes, readBytes, readFloats, readGroupVInt, readInt, readInt, readInts, readLong, readLong, readLongs, readShort, readShort, readVInt, readVLong, seek, slice, wrap
-
Methods inherited from class org.apache.lucene.store.IndexInput
getFullSliceDescription, randomAccessSlice, skipBytes, toString
-
Methods inherited from class org.apache.lucene.store.DataInput
readGroupVInts, readMapOfStrings, readSetOfStrings, readString, readZInt, readZLong
-
-
-
-
Field Detail
-
base
IndexInput base
-
fileOffset
long fileOffset
-
length
long length
-
-
Constructor Detail
-
SlicedIndexInput
SlicedIndexInput(java.lang.String sliceDescription, IndexInput base, long offset, long length)
-
-
Method Detail
-
clone
public BufferedIndexInput.SlicedIndexInput clone()
Description copied from class:IndexInput
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
IndexInput
s, it will only callIndexInput.close()
on the original object.If you access the cloned IndexInput after closing the original object, any
readXXX
methods will throwAlreadyClosedException
.This method is NOT thread safe, so if the current
IndexInput
is being used by one thread whileclone
is called by another, disaster could strike.- Overrides:
clone
in classBufferedIndexInput
-
readInternal
protected void readInternal(java.nio.ByteBuffer b) throws java.io.IOException
Description copied from class:BufferedIndexInput
Expert: implements buffer refill. Reads bytes from the current position in the input.- Specified by:
readInternal
in classBufferedIndexInput
- Parameters:
b
- the buffer to read bytes into- Throws:
java.io.IOException
-
seekInternal
protected void seekInternal(long pos)
Description copied from class:BufferedIndexInput
Expert: implements seek. Sets current position in this file, where the nextBufferedIndexInput.readInternal(ByteBuffer)
will occur.- Specified by:
seekInternal
in classBufferedIndexInput
- See Also:
BufferedIndexInput.readInternal(ByteBuffer)
-
close
public void close() throws java.io.IOException
Description copied from class:IndexInput
Closes the stream to further operations.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in classIndexInput
- Throws:
java.io.IOException
-
length
public long length()
Description copied from class:IndexInput
The number of bytes in the file.- Specified by:
length
in interfaceRandomAccessInput
- Specified by:
length
in classIndexInput
-
-