public final class ByteArrayIndexInput extends IndexInput implements RandomAccessInput
IndexInput backed by a byte array.| Constructor and Description |
|---|
ByteArrayIndexInput(String description,
byte[] bytes) |
ByteArrayIndexInput(String description,
byte[] bytes,
int offs,
int length) |
| Modifier and Type | Method and Description |
|---|---|
IndexInput |
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.
|
byte |
readByte(long pos)
Reads a byte at the given position in the file
|
void |
readBytes(byte[] b,
int offset,
int len)
Reads a specified number of bytes into an array at the specified offset.
|
int |
readInt()
Reads four bytes and returns an int.
|
int |
readInt(long pos)
Reads an integer at the given position in the file
|
long |
readLong()
Reads eight bytes and returns a long.
|
long |
readLong(long pos)
Reads a long at the given position in the file
|
short |
readShort()
Reads two bytes and returns a short.
|
short |
readShort(long pos)
Reads a short at the given position in the file
|
int |
readVInt()
Reads an int stored in variable-length format.
|
long |
readVLong()
Reads a long stored in variable-length format.
|
void |
seek(long pos)
Sets current position in this file, where the next read will occur.
|
ByteArrayIndexInput |
slice(String sliceDescription,
long offset,
long length)
Creates a slice of this index input, with the given description, offset, and length.
|
getFullSliceDescription, randomAccessSlice, toStringreadBytes, readMapOfStrings, readSetOfStrings, readString, readZInt, readZLong, skipBytespublic ByteArrayIndexInput(String description, byte[] bytes)
public ByteArrayIndexInput(String description, byte[] bytes, int offs, int length)
public long getFilePointer()
IndexInputgetFilePointer in class IndexInputIndexInput.seek(long)public void seek(long pos)
throws EOFException
IndexInputEOFException and then the
stream is in an undetermined state.seek in class IndexInputEOFExceptionIndexInput.getFilePointer()public long length()
IndexInputlength in class IndexInputpublic short readShort()
DataInputreadShort in class DataInputDataOutput.writeByte(byte)public int readInt()
DataInputreadInt in class DataInputDataOutput.writeInt(int)public long readLong()
DataInputreadLong in class DataInputDataOutput.writeLong(long)public int readVInt()
DataInput
The format is described further in DataOutput.writeVInt(int).
readVInt in class DataInputDataOutput.writeVInt(int)public long readVLong()
DataInput
The format is described further in DataOutput.writeVInt(int).
readVLong in class DataInputDataOutput.writeVLong(long)public byte readByte()
DataInputreadByte in class DataInputDataOutput.writeByte(byte)public void readBytes(byte[] b,
int offset,
int len)
DataInputreadBytes in class DataInputb - the array to read bytes intooffset - the offset in the array to start storing byteslen - the number of bytes to readDataOutput.writeBytes(byte[],int)public void close()
IndexInputclose in interface Closeableclose in interface AutoCloseableclose in class IndexInputpublic IndexInput 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 IndexInputpublic ByteArrayIndexInput slice(String sliceDescription, long offset, long length)
IndexInputslice in class IndexInputpublic byte readByte(long pos)
throws IOException
RandomAccessInputreadByte in interface RandomAccessInputIOExceptionDataInput.readByte()public short readShort(long pos)
throws IOException
RandomAccessInputreadShort in interface RandomAccessInputIOExceptionDataInput.readShort()public int readInt(long pos)
throws IOException
RandomAccessInputreadInt in interface RandomAccessInputIOExceptionDataInput.readInt()public long readLong(long pos)
throws IOException
RandomAccessInputreadLong in interface RandomAccessInputIOExceptionDataInput.readLong()Copyright © 2000-2018 Apache Software Foundation. All Rights Reserved.