Package org.apache.lucene.store

# Interface RandomAccessInput

All Known Implementing Classes:
  `BufferedIndexInput`, `ByteBuffersDataInput`, `ByteBuffersIndexInput`

public interface RandomAccessInput
Random Access Index API. Unlike `IndexInput`, this has no concept of file position, all reads are absolute. However, like IndexInput, it is only intended for use by a single thread.

## Method Summary

Modifier and Type
Method
Description
`long`
`length()`
The number of bytes in the file.
`default void`
`prefetch(long offset, long length)`
Prefetch data in the background.
`byte`
`readByte(long pos)`
Reads a byte at the given position in the file
`default void`
`readBytes(long pos, byte[] bytes, int offset, int length)`
Reads a specified number of bytes starting at a given position into an array at the specified offset.
`int`
`readInt(long pos)`
Reads an integer (LE byte order) at the given position in the file
`long`
`readLong(long pos)`
Reads a long (LE byte order) at the given position in the file
`short`
`readShort(long pos)`
Reads a short (LE byte order) at the given position in the file

## Method Details

### length

long length()
The number of bytes in the file.

### readByte

byte readByte(long pos) throws IOException
Reads a byte at the given position in the file

Throws:
  `IOException`
See Also:
  - `DataInput.readByte()`

### readBytes

default void readBytes(long pos, byte[] bytes, int offset, int length) throws IOException
Reads a specified number of bytes starting at a given position into an array at the specified offset.

Throws:
  `IOException`
See Also:
  - `DataInput.readBytes(byte[], int, int)`

### readShort

short readShort(long pos) throws IOException
Reads a short (LE byte order) at the given position in the file

Throws:
  `IOException`
See Also:
  - `DataInput.readShort()`
  - `BitUtil.VH_LE_SHORT`

### readInt

int readInt(long pos) throws IOException
Reads an integer (LE byte order) at the given position in the file

Throws:
  `IOException`
See Also:
  - `DataInput.readInt()`
  - `BitUtil.VH_LE_INT`

### readLong

long readLong(long pos) throws IOException
Reads a long (LE byte order) at the given position in the file

Throws:
  `IOException`
See Also:
  - `DataInput.readLong()`
  - `BitUtil.VH_LE_LONG`

### prefetch

default void prefetch(long offset, long length) throws IOException
Prefetch data in the background.

Throws:
  `IOException`
See Also:
  - `IndexInput.prefetch(long, long)`