private static final class NativeUnixDirectory.NativeUnixIndexInput extends IndexInput
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
buffer |
private int |
bufferPos |
private int |
bufferSize |
private java.nio.channels.FileChannel |
channel |
private long |
filePos |
private java.io.FileInputStream |
fis |
private boolean |
isClone |
private boolean |
isOpen |
Constructor and Description |
---|
NativeUnixIndexInput(NativeUnixDirectory.NativeUnixIndexInput other) |
NativeUnixIndexInput(java.nio.file.Path path,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
NativeUnixDirectory.NativeUnixIndexInput |
clone()
Returns a clone of this stream.
|
void |
close()
Closes the stream to further operations.
|
long |
getFilePointer()
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() |
void |
seek(long pos)
Sets current position in this file, where the next read will occur.
|
IndexInput |
slice(java.lang.String sliceDescription,
long offset,
long length)
Creates a slice of this index input, with the given description, offset, and length.
|
getFullSliceDescription, randomAccessSlice, toString
readBytes, readInt, readLong, readMapOfStrings, readSetOfStrings, readShort, readString, readVInt, readVLong, readZInt, readZLong, skipBytes
private final java.nio.ByteBuffer buffer
private final java.io.FileInputStream fis
private final java.nio.channels.FileChannel channel
private final int bufferSize
private boolean isOpen
private boolean isClone
private long filePos
private int bufferPos
public NativeUnixIndexInput(java.nio.file.Path path, int bufferSize) throws java.io.IOException
java.io.IOException
public NativeUnixIndexInput(NativeUnixDirectory.NativeUnixIndexInput other) throws java.io.IOException
java.io.IOException
public void close() throws java.io.IOException
IndexInput
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in class IndexInput
java.io.IOException
public long getFilePointer()
IndexInput
getFilePointer
in class IndexInput
IndexInput.seek(long)
public void seek(long pos) throws java.io.IOException
IndexInput
EOFException
and then the
stream is in an undetermined state.seek
in class IndexInput
java.io.IOException
IndexInput.getFilePointer()
public long length()
IndexInput
length
in class IndexInput
public byte readByte() throws java.io.IOException
DataInput
readByte
in class DataInput
java.io.IOException
DataOutput.writeByte(byte)
private void refill() throws java.io.IOException
java.io.IOException
public void readBytes(byte[] dst, int offset, int len) throws java.io.IOException
DataInput
readBytes
in class DataInput
dst
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to readjava.io.IOException
DataOutput.writeBytes(byte[],int)
public NativeUnixDirectory.NativeUnixIndexInput clone()
IndexInput
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 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 IndexInput
public IndexInput slice(java.lang.String sliceDescription, long offset, long length) throws java.io.IOException
IndexInput
slice
in class IndexInput
java.io.IOException