public final class IndexReader
extends java.lang.Object
Indexer
for a thorough description of how the Index data is produced.
An IndexReader loads the stream passed to it's constructor and applies the appropriate buffering. The Jandex index format is designed for efficient reading and low final memory storage.
Thread-Safety
IndexReader is not thread-safe and can not be shared between concurrent threads. The resulting index, however, is.Modifier and Type | Field and Description |
---|---|
private PackedDataInputStream |
input |
private static int |
MAGIC
The latest index version supported by this version of Jandex.
|
private IndexReaderImpl |
reader |
private int |
version |
Constructor and Description |
---|
IndexReader(java.io.InputStream input)
Constructs a new IndedReader using the passed stream.
|
Modifier and Type | Method and Description |
---|---|
int |
getDataVersion()
Returns the version of the data contract stored in the index that was read.
|
int |
getIndexVersion()
Returns the index file version.
|
private void |
initReader(int version) |
Index |
read()
Read the index at the associated stream of this reader.
|
private void |
readVersion() |
private static final int MAGIC
private PackedDataInputStream input
private int version
private IndexReaderImpl reader
public IndexReader(java.io.InputStream input)
input
- a stream which points to a jandex index filepublic Index read() throws java.io.IOException
java.io.IOException
- if an I/O error occursjava.lang.IllegalArgumentException
- if the stream does not point to Jandex index dataUnsupportedVersion
- if the index data is tagged with a version not known to this readerprivate void initReader(int version) throws java.io.IOException
java.io.IOException
public int getDataVersion() throws java.io.IOException
java.io.IOException
- If the index could not be readpublic int getIndexVersion() throws java.io.IOException
getDataVersion()
should be used instead of this method,
since applications are typically interested in the underlying contract of the data stored, and not the internal
implementation details of a Jandex index.java.io.IOException
- If the index could not be readprivate void readVersion() throws java.io.IOException
java.io.IOException