Class IndexWriterV2
java.lang.Object
org.jboss.jandex.IndexWriterImpl
org.jboss.jandex.IndexWriterV2
Writes a Jandex index file to a stream. The write process is somewhat more
expensive to allow for fast reads and a compact size. For more information on
the index content, see the documentation on
Indexer.
The IndexWriter operates on standard output streams, and also provides suitable buffering.
Thread-Safety
IndexWriter is not thread-safe and can not be shared between concurrent threads.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static class(package private) static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final intprivate static final byteprivate static final byteprivate static final byteprivate static final byteprivate static final intprivate static final intprivate static final int(package private) static final intprivate static final byteprivate static final byteprivate static final byte(package private) static final intprivate NameTableprivate static final intprivate static final intprivate static final byteprivate final OutputStreamprivate static final byteprivate static final byteprivate static final byteprivate static final byteprivate IndexWriterV2.ReferenceTable<Type[]> private IndexWriterV2.ReferenceTable<Type> private final int -
Constructor Summary
ConstructorsConstructorDescriptionIndexWriterV2(OutputStream out, int version) Constructs an IndexWriter using the specified stream -
Method Summary
Modifier and TypeMethodDescriptionprivate voidaddAnnotation(AnnotationInstance instance) private voidaddAnnotationTarget(AnnotationTarget target) private voidprivate voidaddClassName(DotName name) private voidaddClassNames(List<DotName> names) private voidaddEnclosingMethod(ClassInfo.EnclosingMethodInfo enclosingMethod) private voidaddFieldList(FieldInternal[] fields) private voidaddMethodList(MethodInternal[] methods) private voidaddModule(ModuleInfo module) private StringaddNullableString(String name) private voidaddRecordComponentList(RecordComponentInternal[] recordComponents) private Stringprivate voidprivate voidaddTypeList(Type[] types) private voidprivate voidbuildTables(Index index) private voiddeepIntern(FieldInternal field) private voiddeepIntern(MethodInternal method) private voiddeepIntern(RecordComponentInternal recordComponent) private booleanmarkWritten(AnnotationInstance annotation) private booleanmarkWritten(Type[] types) private intpositionOf(byte[] bytes) private intpositionOf(String string) private intpositionOf(AnnotationInstance instance) private intpositionOf(DotName className) private intpositionOf(FieldInternal field) private intpositionOf(MethodInternal method) private intpositionOf(RecordComponentInternal recordComponent) private intpositionOf(Type type) private intpositionOf(Type[] types) (package private) intWrites the specified index to the associated output stream.private voidwriteAnnotation(PackedDataOutputStream stream, AnnotationInstance instance) private voidwriteAnnotations(PackedDataOutputStream stream, Collection<AnnotationInstance> annotations) private voidwriteAnnotations(PackedDataOutputStream stream, AnnotationInstance[] annotations) private voidwriteAnnotationTarget(PackedDataOutputStream stream, AnnotationTarget target) private voidwriteAnnotationValue(PackedDataOutputStream stream, AnnotationValue value) private voidwriteAnnotationValues(PackedDataOutputStream stream, Collection<AnnotationValue> values) private voidwriteByteTable(PackedDataOutputStream stream) private voidwriteClassEntry(PackedDataOutputStream stream, ClassInfo clazz) private voidwriteClasses(PackedDataOutputStream stream, Index index) private voidwriteDotNames(PackedDataOutputStream stream, List<DotName> names) private voidwriteFieldEntry(PackedDataOutputStream stream, FieldInternal field) private voidprivate voidwriteMethodEntry(PackedDataOutputStream stream, MethodInternal method) private voidprivate voidwriteModuleEntry(PackedDataOutputStream stream, ModuleInfo module) private voidwriteModules(PackedDataOutputStream stream, Index index) private voidwriteNameTable(PackedDataOutputStream stream) private voidwriteRecordComponentEntry(PackedDataOutputStream stream, RecordComponentInternal recordComponent) private voidprivate voidwriteReference(PackedDataOutputStream stream, Type type, boolean nullable) private voidwriteReferenceOrFull(PackedDataOutputStream stream, AnnotationInstance annotation) private voidwriteReferenceOrFull(PackedDataOutputStream stream, Type[] types) private voidprivate voidwriteTypeEntry(PackedDataOutputStream stream, Type type) private voidwriteTypeListEntry(PackedDataOutputStream stream, Type[] types) private voidprivate voidwriteTypeTable(PackedDataOutputStream stream) private voidwriteTypeTarget(PackedDataOutputStream stream, TypeTarget typeTarget) private voidwriteTypeTargetFields(PackedDataOutputStream stream, byte tag, TypeTarget target) private voidwriteUsersSet(PackedDataOutputStream stream, DotName user, ClassInfo[] uses) private voidwriteUsersTable(PackedDataOutputStream stream, Map<DotName, ClassInfo[]> users)
-
Field Details
-
MIN_VERSION
static final int MIN_VERSION- See Also:
-
MAX_VERSION
static final int MAX_VERSION- See Also:
-
MAGIC
private static final int MAGIC- See Also:
-
NULL_TARGET_TAG
private static final byte NULL_TARGET_TAG- 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:
-
EMPTY_TYPE_TAG
private static final byte EMPTY_TYPE_TAG- See Also:
-
CLASS_EXTENDS_TYPE_TAG
private static final byte CLASS_EXTENDS_TYPE_TAG- See Also:
-
TYPE_PARAMETER_TAG
private static final byte TYPE_PARAMETER_TAG- See Also:
-
TYPE_PARAMETER_BOUND_TAG
private static final byte TYPE_PARAMETER_BOUND_TAG- See Also:
-
METHOD_PARAMETER_TYPE_TAG
private static final byte METHOD_PARAMETER_TYPE_TAG- See Also:
-
THROWS_TYPE_TAG
private static final byte THROWS_TYPE_TAG- See Also:
-
RECORD_COMPONENT_TAG
private static final byte RECORD_COMPONENT_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:
-
HAS_ENCLOSING_METHOD
private static final int HAS_ENCLOSING_METHOD- See Also:
-
NO_ENCLOSING_METHOD
private static final int NO_ENCLOSING_METHOD- See Also:
-
NO_NESTING
private static final int NO_NESTING- See Also:
-
HAS_NESTING
private static final int HAS_NESTING- See Also:
-
out
-
version
private final int version -
names
-
nameTable
-
sortedNameTable
-
annotationTable
-
typeTable
-
typeListTable
-
-
Constructor Details
-
IndexWriterV2
IndexWriterV2(OutputStream out, int version) Constructs an IndexWriter using the specified stream- Parameters:
out- a stream to write an index toversion- the index file version
-
-
Method Details
-
write
Writes the specified index to the associated output stream. This may be called multiple times in order to write multiple indexes.- Specified by:
writein classIndexWriterImpl- Parameters:
index- the index to write to the stream- Returns:
- the number of bytes written to the stream
- Throws:
IOException- if any i/o error occurs
-
writeUsersTable
private void writeUsersTable(PackedDataOutputStream stream, Map<DotName, ClassInfo[]> users) throws IOException - Throws:
IOException
-
writeUsersSet
private void writeUsersSet(PackedDataOutputStream stream, DotName user, ClassInfo[] uses) throws IOException - Throws:
IOException
-
writeStringTable
- Throws:
IOException
-
writeByteTable
- Throws:
IOException
-
writeTypeTable
- Throws:
IOException
-
writeTypeListTable
- Throws:
IOException
-
writeTypeListEntry
- Throws:
IOException
-
writeMethodTable
- Throws:
IOException
-
writeFieldTable
- Throws:
IOException
-
writeRecordComponentTable
- Throws:
IOException
-
writeFieldEntry
- Throws:
IOException
-
writeRecordComponentEntry
private void writeRecordComponentEntry(PackedDataOutputStream stream, RecordComponentInternal recordComponent) throws IOException - Throws:
IOException
-
writeMethodEntry
private void writeMethodEntry(PackedDataOutputStream stream, MethodInternal method) throws IOException - Throws:
IOException
-
writeAnnotation
private void writeAnnotation(PackedDataOutputStream stream, AnnotationInstance instance) throws IOException - Throws:
IOException
-
writeAnnotationTarget
private void writeAnnotationTarget(PackedDataOutputStream stream, AnnotationTarget target) throws IOException - Throws:
IOException
-
writeTypeTarget
private void writeTypeTarget(PackedDataOutputStream stream, TypeTarget typeTarget) throws IOException - Throws:
IOException
-
writeTypeTargetFields
private void writeTypeTargetFields(PackedDataOutputStream stream, byte tag, TypeTarget target) throws IOException - Throws:
IOException
-
writeNameTable
- Throws:
IOException
-
positionOf
-
positionOf
private int positionOf(byte[] bytes) -
positionOf
-
positionOf
-
positionOf
-
positionOf
-
positionOf
-
positionOf
-
positionOf
-
markWritten
-
markWritten
-
writeClasses
- Throws:
IOException
-
writeModules
- Throws:
IOException
-
writeClassEntry
- Throws:
IOException
-
writeModuleEntry
- Throws:
IOException
-
writeDotNames
- Throws:
IOException
-
writeAnnotationValues
private void writeAnnotationValues(PackedDataOutputStream stream, Collection<AnnotationValue> values) throws IOException - Throws:
IOException
-
writeAnnotationValue
private void writeAnnotationValue(PackedDataOutputStream stream, AnnotationValue value) throws IOException - Throws:
IOException
-
writeReference
private void writeReference(PackedDataOutputStream stream, Type type, boolean nullable) throws IOException - Throws:
IOException
-
writeAnnotations
private void writeAnnotations(PackedDataOutputStream stream, AnnotationInstance[] annotations) throws IOException - Throws:
IOException
-
writeAnnotations
private void writeAnnotations(PackedDataOutputStream stream, Collection<AnnotationInstance> annotations) throws IOException - Throws:
IOException
-
writeReferenceOrFull
private void writeReferenceOrFull(PackedDataOutputStream stream, AnnotationInstance annotation) throws IOException - Throws:
IOException
-
writeReferenceOrFull
- Throws:
IOException
-
writeTypeEntry
- Throws:
IOException
-
buildTables
-
addClass
-
addModule
-
addAnnotation
-
addAnnotationTarget
-
addFieldList
-
deepIntern
-
addMethodList
-
deepIntern
-
addRecordComponentList
-
deepIntern
-
addEnclosingMethod
-
addTypeList
-
addType
-
buildAValueEntries
-
addNullableString
-
addString
-
addClassNames
-
addClassName
-