Module org.apache.lucene.misc
Package org.apache.lucene.misc.store
Class DirectIODirectory.DirectIOIndexInput
java.lang.Object
org.apache.lucene.store.DataInput
org.apache.lucene.store.IndexInput
org.apache.lucene.misc.store.DirectIODirectory.DirectIOIndexInput
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Cloneable
- Enclosing class:
- DirectIODirectory
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final int
private final ByteBuffer
private final FileChannel
private long
private boolean
private boolean
-
Constructor Summary
ConstructorsModifierConstructorDescriptionDirectIOIndexInput
(Path path, int blockSize, int bufferSize) Creates a new instance of DirectIOIndexInput for reading index input with direct IO bypassing OS bufferprivate
-
Method Summary
Modifier and TypeMethodDescriptionclone()
Returns a clone of this stream.void
close()
Closes the stream to further operations.long
Returns the current position in this file, where the next read will occur.long
length()
The number of bytes in the file.byte
readByte()
Reads and returns a single byte.void
readBytes
(byte[] dst, int offset, int len) Reads a specified number of bytes into an array at the specified offset.private void
refill
(int bytesToRead) void
seek
(long pos) Sets current position in this file, where the next read will occur.Creates a slice of this index input, with the given description, offset, and length.Methods inherited from class org.apache.lucene.store.IndexInput
getFullSliceDescription, randomAccessSlice, skipBytes, toString
Methods inherited from class org.apache.lucene.store.DataInput
readBytes, readFloats, readInt, readInts, readLong, readLongs, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong
-
Field Details
-
buffer
-
channel
-
blockSize
private final int blockSize -
isOpen
private boolean isOpen -
isClone
private boolean isClone -
filePos
private long filePos
-
-
Constructor Details
-
DirectIOIndexInput
Creates a new instance of DirectIOIndexInput for reading index input with direct IO bypassing OS buffer- Throws:
UnsupportedOperationException
- if the JDK does not support Direct I/OIOException
- if the operating system or filesystem does not support support Direct I/O or a sufficient equivalent.
-
DirectIOIndexInput
- Throws:
IOException
-
-
Method Details
-
close
Description copied from class:IndexInput
Closes the stream to further operations.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in classIndexInput
- Throws:
IOException
-
getFilePointer
public long getFilePointer()Description copied from class:IndexInput
Returns the current position in this file, where the next read will occur.- Specified by:
getFilePointer
in classIndexInput
- See Also:
-
seek
Description copied from class:IndexInput
Sets current position in this file, where the next read will occur. If this is beyond the end of the file then this will throwEOFException
and then the stream is in an undetermined state.- Specified by:
seek
in classIndexInput
- Throws:
IOException
- See Also:
-
length
public long length()Description copied from class:IndexInput
The number of bytes in the file.- Specified by:
length
in classIndexInput
-
readByte
Description copied from class:DataInput
Reads and returns a single byte.- Specified by:
readByte
in classDataInput
- Throws:
IOException
- See Also:
-
refill
- Throws:
IOException
-
readBytes
Description copied from class:DataInput
Reads a specified number of bytes into an array at the specified offset.- Specified by:
readBytes
in classDataInput
- Parameters:
dst
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to read- Throws:
IOException
- See Also:
-
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 classIndexInput
-
slice
Description copied from class:IndexInput
Creates a slice of this index input, with the given description, offset, and length. The slice is sought to the beginning.- Specified by:
slice
in classIndexInput
-