static final class RAFDirectory.RAFIndexInput extends BufferedIndexInput
RandomAccessFile.seek(long) followed by
RandomAccessFile.read(byte[], int, int).| Modifier and Type | Field and Description |
|---|---|
private static int |
CHUNK_SIZE
The maximum chunk size is 8192 bytes, because
RandomAccessFile mallocs
a native buffer outside of stack if the read buffer size is larger. |
protected long |
end
end offset (start+length)
|
protected java.io.RandomAccessFile |
file
the file channel we will read from
|
(package private) boolean |
isClone
is this instance a clone and hence does not own the file to close it
|
protected long |
off
start offset: non-zero in the slice case
|
buffer, BUFFER_SIZE, MERGE_BUFFER_SIZE, MIN_BUFFER_SIZE| Constructor and Description |
|---|
RAFIndexInput(java.lang.String resourceDesc,
java.io.RandomAccessFile file,
IOContext context) |
RAFIndexInput(java.lang.String resourceDesc,
java.io.RandomAccessFile file,
long off,
long length,
int bufferSize) |
| Modifier and Type | Method and Description |
|---|---|
RAFDirectory.RAFIndexInput |
clone()
Returns a clone of this stream.
|
void |
close()
Closes the stream to further operations.
|
(package private) boolean |
isFDValid() |
long |
length()
The number of bytes in the file.
|
protected void |
readInternal(byte[] b,
int offset,
int len)
IndexInput methods
|
protected void |
seekInternal(long pos)
Expert: implements seek.
|
IndexInput |
slice(java.lang.String sliceDescription,
long offset,
long length)
Creates a slice of this index input, with the given description, offset, and length.
|
bufferSize, flushBuffer, getBufferSize, getFilePointer, newBuffer, readByte, readByte, readBytes, readBytes, readInt, readInt, readLong, readLong, readShort, readShort, readVInt, readVLong, seek, setBufferSize, wrapgetFullSliceDescription, randomAccessSlice, toStringreadLELongs, readMapOfStrings, readSetOfStrings, readString, readZInt, readZLong, skipBytesprivate static final int CHUNK_SIZE
RandomAccessFile mallocs
a native buffer outside of stack if the read buffer size is larger.protected final java.io.RandomAccessFile file
boolean isClone
protected final long off
protected final long end
public RAFIndexInput(java.lang.String resourceDesc,
java.io.RandomAccessFile file,
IOContext context)
throws java.io.IOException
java.io.IOExceptionpublic RAFIndexInput(java.lang.String resourceDesc,
java.io.RandomAccessFile file,
long off,
long length,
int bufferSize)
public void close()
throws java.io.IOException
IndexInputclose in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class IndexInputjava.io.IOExceptionpublic RAFDirectory.RAFIndexInput clone()
IndexInputClones 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 IndexInput.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.
clone in class BufferedIndexInputpublic IndexInput slice(java.lang.String sliceDescription, long offset, long length) throws java.io.IOException
IndexInputslice in class BufferedIndexInputjava.io.IOExceptionpublic final long length()
IndexInputlength in class IndexInputprotected void readInternal(byte[] b,
int offset,
int len)
throws java.io.IOException
readInternal in class BufferedIndexInputb - the array to read bytes intooffset - the offset in the array to start storing byteslen - the number of bytes to readjava.io.IOExceptionprotected void seekInternal(long pos)
throws java.io.IOException
BufferedIndexInputBufferedIndexInput.readInternal(byte[],int,int) will occur.seekInternal in class BufferedIndexInputjava.io.IOExceptionBufferedIndexInput.readInternal(byte[],int,int)boolean isFDValid()
throws java.io.IOException
java.io.IOException