Package org.jboss.jandex
Class IndexReaderV1
java.lang.Object
org.jboss.jandex.IndexReaderImpl
org.jboss.jandex.IndexReaderV1
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.-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final int
private static final byte
private DotName[]
private static final byte
private PackedDataInputStream
private HashMap
<DotName, List<AnnotationInstance>> (package private) static final int
private static final byte
private static final byte
(package private) static final int
private String[]
-
Constructor Summary
ConstructorsConstructorDescriptionConstructs a new IndedReader using the passed stream. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
(package private) Index
read
(int version) Read the index at the associated stream of this reader.private void
readAnnotations
(PackedDataInputStream stream, Map<DotName, List<AnnotationInstance>> annotations, ClassInfo clazz) private AnnotationValue[]
private Index
readClasses
(PackedDataInputStream stream, int version) private void
readClassTable
(PackedDataInputStream stream) private MethodInfo
readMethod
(ClassInfo clazz, PackedDataInputStream stream) private void
readStringTable
(PackedDataInputStream stream) private Type
readType
(PackedDataInputStream stream) private void
recordAnnotation
(Map<DotName, List<AnnotationInstance>> annotations, DotName annotation, AnnotationInstance instance) (package private) int
toDataVersion
(int version)
-
Field Details
-
MIN_VERSION
static final int MIN_VERSION- See Also:
-
MAX_VERSION
static final int MAX_VERSION- See Also:
-
FIELD_TAG
private static final byte FIELD_TAG- See Also:
-
METHOD_TAG
private static final byte METHOD_TAG- See Also:
-
METHOD_PARAMETER_TAG
private static final byte METHOD_PARAMETER_TAG- See Also:
-
CLASS_TAG
private static final byte CLASS_TAG- See Also:
-
AVALUE_BYTE
private static final int AVALUE_BYTE- See Also:
-
AVALUE_SHORT
private static final int AVALUE_SHORT- See Also:
-
AVALUE_INT
private static final int AVALUE_INT- See Also:
-
AVALUE_CHAR
private static final int AVALUE_CHAR- See Also:
-
AVALUE_FLOAT
private static final int AVALUE_FLOAT- See Also:
-
AVALUE_DOUBLE
private static final int AVALUE_DOUBLE- See Also:
-
AVALUE_LONG
private static final int AVALUE_LONG- See Also:
-
AVALUE_BOOLEAN
private static final int AVALUE_BOOLEAN- See Also:
-
AVALUE_STRING
private static final int AVALUE_STRING- See Also:
-
AVALUE_CLASS
private static final int AVALUE_CLASS- See Also:
-
AVALUE_ENUM
private static final int AVALUE_ENUM- See Also:
-
AVALUE_ARRAY
private static final int AVALUE_ARRAY- See Also:
-
AVALUE_NESTED
private static final int AVALUE_NESTED- See Also:
-
input
-
classTable
-
stringTable
-
masterAnnotations
-
-
Constructor Details
-
IndexReaderV1
IndexReaderV1(PackedDataInputStream input) Constructs a new IndedReader using the passed stream. The stream is not read from until the read method is called.- Parameters:
input
- a stream which points to a jandex index file
-
-
Method Details
-
read
Read the index at the associated stream of this reader. This method can be called multiple times if the stream contains multiple index files.- Specified by:
read
in classIndexReaderImpl
- Returns:
- the Index contained in the stream
- Throws:
IOException
- if an I/O error occursIllegalArgumentException
- if the stream does not point to Jandex index dataUnsupportedVersion
- if the index data is tagged with a version not known to this reader
-
readClasses
- Throws:
IOException
-
readAnnotations
private void readAnnotations(PackedDataInputStream stream, Map<DotName, List<AnnotationInstance>> annotations, ClassInfo clazz) throws IOException- Throws:
IOException
-
readAnnotationValues
- Throws:
IOException
-
readMethod
- Throws:
IOException
-
recordAnnotation
private void recordAnnotation(Map<DotName, List<AnnotationInstance>> annotations, DotName annotation, AnnotationInstance instance) -
addClassToMap
-
readType
- Throws:
IOException
-
readStringTable
- Throws:
IOException
-
readClassTable
- Throws:
IOException
-
toDataVersion
int toDataVersion(int version) - Specified by:
toDataVersion
in classIndexReaderImpl
-