Package org.jboss.jandex
Class IndexReaderV1
- java.lang.Object
-
- org.jboss.jandex.IndexReaderImpl
-
- org.jboss.jandex.IndexReaderV1
-
final class IndexReaderV1 extends IndexReaderImpl
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 static int
AVALUE_ARRAY
private static int
AVALUE_BOOLEAN
private static int
AVALUE_BYTE
private static int
AVALUE_CHAR
private static int
AVALUE_CLASS
private static int
AVALUE_DOUBLE
private static int
AVALUE_ENUM
private static int
AVALUE_FLOAT
private static int
AVALUE_INT
private static int
AVALUE_LONG
private static int
AVALUE_NESTED
private static int
AVALUE_SHORT
private static int
AVALUE_STRING
private static byte
CLASS_TAG
private DotName[]
classTable
private static byte
FIELD_TAG
private PackedDataInputStream
input
private java.util.HashMap<DotName,java.util.List<AnnotationInstance>>
masterAnnotations
(package private) static int
MAX_VERSION
private static byte
METHOD_PARAMETER_TAG
private static byte
METHOD_TAG
(package private) static int
MIN_VERSION
private java.lang.String[]
stringTable
-
Constructor Summary
Constructors Constructor Description IndexReaderV1(PackedDataInputStream input)
Constructs a new IndedReader using the passed stream.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addClassToMap(java.util.HashMap<DotName,java.util.List<ClassInfo>> map, DotName name, ClassInfo currentClass)
(package private) Index
read(int version)
Read the index at the associated stream of this reader.private void
readAnnotations(PackedDataInputStream stream, java.util.Map<DotName,java.util.List<AnnotationInstance>> annotations, ClassInfo clazz)
private AnnotationValue[]
readAnnotationValues(PackedDataInputStream stream)
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(java.util.Map<DotName,java.util.List<AnnotationInstance>> annotations, DotName annotation, AnnotationInstance instance)
(package private) int
toDataVersion(int version)
-
-
-
Field Detail
-
MIN_VERSION
static final int MIN_VERSION
- See Also:
- Constant Field Values
-
MAX_VERSION
static final int MAX_VERSION
- See Also:
- Constant Field Values
-
FIELD_TAG
private static final byte FIELD_TAG
- See Also:
- Constant Field Values
-
METHOD_TAG
private static final byte METHOD_TAG
- See Also:
- Constant Field Values
-
METHOD_PARAMETER_TAG
private static final byte METHOD_PARAMETER_TAG
- See Also:
- Constant Field Values
-
CLASS_TAG
private static final byte CLASS_TAG
- See Also:
- Constant Field Values
-
AVALUE_BYTE
private static final int AVALUE_BYTE
- See Also:
- Constant Field Values
-
AVALUE_SHORT
private static final int AVALUE_SHORT
- See Also:
- Constant Field Values
-
AVALUE_INT
private static final int AVALUE_INT
- See Also:
- Constant Field Values
-
AVALUE_CHAR
private static final int AVALUE_CHAR
- See Also:
- Constant Field Values
-
AVALUE_FLOAT
private static final int AVALUE_FLOAT
- See Also:
- Constant Field Values
-
AVALUE_DOUBLE
private static final int AVALUE_DOUBLE
- See Also:
- Constant Field Values
-
AVALUE_LONG
private static final int AVALUE_LONG
- See Also:
- Constant Field Values
-
AVALUE_BOOLEAN
private static final int AVALUE_BOOLEAN
- See Also:
- Constant Field Values
-
AVALUE_STRING
private static final int AVALUE_STRING
- See Also:
- Constant Field Values
-
AVALUE_CLASS
private static final int AVALUE_CLASS
- See Also:
- Constant Field Values
-
AVALUE_ENUM
private static final int AVALUE_ENUM
- See Also:
- Constant Field Values
-
AVALUE_ARRAY
private static final int AVALUE_ARRAY
- See Also:
- Constant Field Values
-
AVALUE_NESTED
private static final int AVALUE_NESTED
- See Also:
- Constant Field Values
-
input
private PackedDataInputStream input
-
classTable
private DotName[] classTable
-
stringTable
private java.lang.String[] stringTable
-
masterAnnotations
private java.util.HashMap<DotName,java.util.List<AnnotationInstance>> masterAnnotations
-
-
Constructor Detail
-
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 Detail
-
read
Index read(int version) 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.- Specified by:
read
in classIndexReaderImpl
- 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
-
readClasses
private Index readClasses(PackedDataInputStream stream, int version) throws java.io.IOException
- Throws:
java.io.IOException
-
readAnnotations
private void readAnnotations(PackedDataInputStream stream, java.util.Map<DotName,java.util.List<AnnotationInstance>> annotations, ClassInfo clazz) throws java.io.IOException
- Throws:
java.io.IOException
-
readAnnotationValues
private AnnotationValue[] readAnnotationValues(PackedDataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
readMethod
private MethodInfo readMethod(ClassInfo clazz, PackedDataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
recordAnnotation
private void recordAnnotation(java.util.Map<DotName,java.util.List<AnnotationInstance>> annotations, DotName annotation, AnnotationInstance instance)
-
addClassToMap
private void addClassToMap(java.util.HashMap<DotName,java.util.List<ClassInfo>> map, DotName name, ClassInfo currentClass)
-
readType
private Type readType(PackedDataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
readStringTable
private void readStringTable(PackedDataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
readClassTable
private void readClassTable(PackedDataInputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
toDataVersion
int toDataVersion(int version)
- Specified by:
toDataVersion
in classIndexReaderImpl
-
-