Package org.jboss.jandex
Class IndexReader
- java.lang.Object
-
- org.jboss.jandex.IndexReader
-
public final class IndexReader extends java.lang.Object
Reads a Jandex index file and returns the saved index. SeeIndexer
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.
-
-
Field Summary
Fields Modifier and Type Field 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 Summary
Constructors Constructor Description IndexReader(java.io.InputStream input)
Constructs a new IndedReader using the passed stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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()
-
-
-
Field Detail
-
MAGIC
private static final int MAGIC
The latest index version supported by this version of Jandex.- See Also:
- Constant Field Values
-
input
private PackedDataInputStream input
-
version
private int version
-
reader
private IndexReaderImpl reader
-
-
Method Detail
-
read
public Index read() throws java.io.IOException
Read the index at the associated stream of this reader. This method can be called multiple times if the stream contains multiple index files.- Returns:
- the Index contained in the stream
- Throws:
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 reader
-
initReader
private void initReader(int version) throws java.io.IOException
- Throws:
java.io.IOException
-
getIndexVersion
public int getIndexVersion() throws java.io.IOException
Returns the index file version. This version number marks the internal storage format and also implies the version of data contract of the index. It is incremented whenever more information are added to the index format, so it may be used to determine whether an index file contains necessary information.- Returns:
- the index file version
- Throws:
java.io.IOException
- If the index could not be read
-
readVersion
private void readVersion() throws java.io.IOException
- Throws:
java.io.IOException
-
-