Top Description Fields Constructors Methods
org.jboss.jandex

public final Class IndexReader

extends Object
Class Inheritance
Imports
java.io.BufferedInputStream, .IOException, .InputStream

Reads a Jandex index file and returns the saved index. See 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.
Author
Jason T. Greene

Field Summary

Modifier and TypeField and Description
private PackedDataInputStream
private static final int
MAGIC

The latest index version supported by this version of Jandex.

private IndexReaderImpl
private int

Constructor Summary

AccessConstructor and Description
public
IndexReader(InputStream
a stream which points to a jandex index file
input
)

Constructs a new IndedReader using the passed stream.

Method Summary

Modifier and TypeMethod and Description
public int

Returns:

the index file version
getIndexVersion
()

Returns the index file version.

private void
initReader(int version)

public Index

Returns:

the Index contained in the stream
read
()

Read the index at the associated stream of this reader.

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

inputback to summary
private PackedDataInputStream input
MAGICback to summary
private static final int MAGIC

The latest index version supported by this version of Jandex.

readerback to summary
private IndexReaderImpl reader
versionback to summary
private int version

Constructor Detail

IndexReaderback to summary
public IndexReader(InputStream input)

Constructs a new IndedReader using the passed stream. The stream is not read from until the read method is called.

Parameters
input:InputStream

a stream which points to a jandex index file

Method Detail

getIndexVersionback to summary
public int getIndexVersion() throws 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:int

the index file version

Exceptions
IOException:
If the index could not be read
initReaderback to summary
private void initReader(int version) throws IOException
readback to summary
public Index read() throws 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:Index

the Index contained in the stream

Exceptions
IOException:
if an I/O error occurs
IllegalArgumentException:
if the stream does not point to Jandex index data
UnsupportedVersion:
if the index data is tagged with a version not known to this reader
readVersionback to summary
private void readVersion() throws IOException