Top Description Inners Fields Constructors Methods
org.jboss.jandex

pack-priv final Class IndexWriterV2

extends IndexWriterImpl
Class Inheritance
Imports
java.io.BufferedOutputStream, .IOException, .OutputStream, java.util.ArrayList, .Collection, .HashMap, .IdentityHashMap, .Iterator, .List, .Map, .Map.Entry, .Set, .TreeMap

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 org.jboss.jandex.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.
Author
Jason T. Greene
See Also
org.jboss.jandex.Indexer, org.jboss.jandex.Index

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
pack-priv static class

Field Summary

Modifier and TypeField and Description
private IndexWriterV2.ReferenceTable<AnnotationInstance>
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 int
private static final byte
private static final byte
private static final byte
private static final byte
private static final int
private static final int
private static final int
pack-priv static final int
private static final byte
private static final byte
private static final byte
pack-priv static final int
private NameTable
private HashMap<DotName, Integer>
private static final int
private static final int
private static final byte
private final OutputStream
private static final byte
private TreeMap<String, DotName>
private static final byte
private static final byte
private static final byte
private IndexWriterV2.ReferenceTable<Type[]>
private IndexWriterV2.ReferenceTable<Type>
private final int

Constructor Summary

AccessConstructor and Description
pack-priv
IndexWriterV2(OutputStream
a stream to write an index to
out
,
int version)

Constructs an IndexWriter using the specified stream

Method Summary

Modifier and TypeMethod and Description
private void
private void
private void
private void
private void
private void
private void
private void
private void
private String
private void
private String
private void
addType(Type type)

private void
addTypeList(Type[] types)

private void
private void
private void
private void
private void
private boolean
markWritten(Type[] types)

private boolean
private int
private int
positionOf(byte[] bytes)

private int
private int
private int
private int
positionOf(DotName className)

private int
private int
positionOf(Type[] types)

private int
pack-priv int

Returns:

the number of bytes written to the stream
write
(Index
the index to write to the stream
index
)

Implements abstract org.jboss.jandex.IndexWriterImpl.write.

Writes the specified index to the associated output stream.
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
writeReference(PackedDataOutputStream stream, Type type, boolean nullable)

private void
private void
private void
private void
private void
private void
private void
private void
private void
private void
private void

Field Detail

annotationTableback to summary
private IndexWriterV2.ReferenceTable<AnnotationInstance> annotationTable
AVALUE_ARRAYback to summary
private static final int AVALUE_ARRAY
AVALUE_BOOLEANback to summary
private static final int AVALUE_BOOLEAN
AVALUE_BYTEback to summary
private static final int AVALUE_BYTE
AVALUE_CHARback to summary
private static final int AVALUE_CHAR
AVALUE_CLASSback to summary
private static final int AVALUE_CLASS
AVALUE_DOUBLEback to summary
private static final int AVALUE_DOUBLE
AVALUE_ENUMback to summary
private static final int AVALUE_ENUM
AVALUE_FLOATback to summary
private static final int AVALUE_FLOAT
AVALUE_INTback to summary
private static final int AVALUE_INT
AVALUE_LONGback to summary
private static final int AVALUE_LONG
AVALUE_NESTEDback to summary
private static final int AVALUE_NESTED
AVALUE_SHORTback to summary
private static final int AVALUE_SHORT
AVALUE_STRINGback to summary
private static final int AVALUE_STRING
CLASS_EXTENDS_TYPE_TAGback to summary
private static final byte CLASS_EXTENDS_TYPE_TAG
CLASS_TAGback to summary
private static final byte CLASS_TAG
EMPTY_TYPE_TAGback to summary
private static final byte EMPTY_TYPE_TAG
FIELD_TAGback to summary
private static final byte FIELD_TAG
HAS_ENCLOSING_METHODback to summary
private static final int HAS_ENCLOSING_METHOD
HAS_NESTINGback to summary
private static final int HAS_NESTING
MAGICback to summary
private static final int MAGIC
MAX_VERSIONback to summary
pack-priv static final int MAX_VERSION
METHOD_PARAMETER_TAGback to summary
private static final byte METHOD_PARAMETER_TAG
METHOD_PARAMETER_TYPE_TAGback to summary
private static final byte METHOD_PARAMETER_TYPE_TAG
METHOD_TAGback to summary
private static final byte METHOD_TAG
MIN_VERSIONback to summary
pack-priv static final int MIN_VERSION
namesback to summary
private NameTable names
nameTableback to summary
private HashMap<DotName, Integer> nameTable
NO_ENCLOSING_METHODback to summary
private static final int NO_ENCLOSING_METHOD
NO_NESTINGback to summary
private static final int NO_NESTING
NULL_TARGET_TAGback to summary
private static final byte NULL_TARGET_TAG
outback to summary
private final OutputStream out
RECORD_COMPONENT_TAGback to summary
private static final byte RECORD_COMPONENT_TAG
sortedNameTableback to summary
private TreeMap<String, DotName> sortedNameTable
THROWS_TYPE_TAGback to summary
private static final byte THROWS_TYPE_TAG
TYPE_PARAMETER_BOUND_TAGback to summary
private static final byte TYPE_PARAMETER_BOUND_TAG
TYPE_PARAMETER_TAGback to summary
private static final byte TYPE_PARAMETER_TAG
typeListTableback to summary
private IndexWriterV2.ReferenceTable<Type[]> typeListTable
typeTableback to summary
private IndexWriterV2.ReferenceTable<Type> typeTable
versionback to summary
private final int version

Constructor Detail

IndexWriterV2back to summary
pack-priv IndexWriterV2(OutputStream out, int version)

Constructs an IndexWriter using the specified stream

Parameters
out:OutputStream

a stream to write an index to

Method Detail

addAnnotationback to summary
private void addAnnotation(AnnotationInstance instance)
addAnnotationTargetback to summary
private void addAnnotationTarget(AnnotationTarget target)
addClassback to summary
private void addClass(ClassInfo clazz)
addClassNameback to summary
private void addClassName(DotName name)
addClassNamesback to summary
private void addClassNames(List<DotName> names)
addEnclosingMethodback to summary
private void addEnclosingMethod(ClassInfo.EnclosingMethodInfo enclosingMethod)
addFieldListback to summary
private void addFieldList(FieldInternal[] fields)
addMethodListback to summary
private void addMethodList(MethodInternal[] methods)
addModuleback to summary
private void addModule(ModuleInfo module)
addNullableStringback to summary
private String addNullableString(String name)
addRecordComponentListback to summary
private void addRecordComponentList(RecordComponentInternal[] recordComponents)
addStringback to summary
private String addString(String name)
addTypeback to summary
private void addType(Type type)
addTypeListback to summary
private void addTypeList(Type[] types)
buildAValueEntriesback to summary
private void buildAValueEntries(AnnotationValue value)
buildTablesback to summary
private void buildTables(Index index)
deepInternback to summary
private void deepIntern(FieldInternal field)
deepInternback to summary
private void deepIntern(MethodInternal method)
deepInternback to summary
private void deepIntern(RecordComponentInternal recordComponent)
markWrittenback to summary
private boolean markWritten(Type[] types)
markWrittenback to summary
private boolean markWritten(AnnotationInstance annotation)
positionOfback to summary
private int positionOf(String string)
positionOfback to summary
private int positionOf(byte[] bytes)
positionOfback to summary
private int positionOf(MethodInternal method)
positionOfback to summary
private int positionOf(FieldInternal field)
positionOfback to summary
private int positionOf(RecordComponentInternal recordComponent)
positionOfback to summary
private int positionOf(DotName className)
positionOfback to summary
private int positionOf(Type type)
positionOfback to summary
private int positionOf(Type[] types)
positionOfback to summary
private int positionOf(AnnotationInstance instance)
writeback to summary
pack-priv int write(Index index) throws IOException

Implements abstract org.jboss.jandex.IndexWriterImpl.write.

Writes the specified index to the associated output stream. This may be called multiple times in order to write multiple indexes.

Parameters
index:Index

the index to write to the stream

Returns:int

the number of bytes written to the stream

Exceptions
IOException:
if any i/o error occurs
writeAnnotationback to summary
private void writeAnnotation(PackedDataOutputStream stream, AnnotationInstance instance) throws IOException
writeAnnotationsback to summary
private void writeAnnotations(PackedDataOutputStream stream, AnnotationInstance[] annotations) throws IOException
writeAnnotationsback to summary
private void writeAnnotations(PackedDataOutputStream stream, Collection<AnnotationInstance> annotations) throws IOException
writeAnnotationTargetback to summary
private void writeAnnotationTarget(PackedDataOutputStream stream, AnnotationTarget target) throws IOException
writeAnnotationValueback to summary
private void writeAnnotationValue(PackedDataOutputStream stream, AnnotationValue value) throws IOException
writeAnnotationValuesback to summary
private void writeAnnotationValues(PackedDataOutputStream stream, Collection<AnnotationValue> values) throws IOException
writeByteTableback to summary
private void writeByteTable(PackedDataOutputStream stream) throws IOException
writeClassEntryback to summary
private void writeClassEntry(PackedDataOutputStream stream, ClassInfo clazz) throws IOException
writeClassesback to summary
private void writeClasses(PackedDataOutputStream stream, Index index) throws IOException
writeDotNamesback to summary
private void writeDotNames(PackedDataOutputStream stream, List<DotName> names) throws IOException
writeFieldEntryback to summary
private void writeFieldEntry(PackedDataOutputStream stream, FieldInternal field) throws IOException
writeFieldTableback to summary
private void writeFieldTable(PackedDataOutputStream stream) throws IOException
writeMethodEntryback to summary
private void writeMethodEntry(PackedDataOutputStream stream, MethodInternal method) throws IOException
writeMethodTableback to summary
private void writeMethodTable(PackedDataOutputStream stream) throws IOException
writeModuleEntryback to summary
private void writeModuleEntry(PackedDataOutputStream stream, ModuleInfo module) throws IOException
writeModulesback to summary
private void writeModules(PackedDataOutputStream stream, Index index) throws IOException
writeNameTableback to summary
private void writeNameTable(PackedDataOutputStream stream) throws IOException
writeRecordComponentEntryback to summary
private void writeRecordComponentEntry(PackedDataOutputStream stream, RecordComponentInternal recordComponent) throws IOException
writeRecordComponentTableback to summary
private void writeRecordComponentTable(PackedDataOutputStream stream) throws IOException
writeReferenceback to summary
private void writeReference(PackedDataOutputStream stream, Type type, boolean nullable) throws IOException
writeReferenceOrFullback to summary
private void writeReferenceOrFull(PackedDataOutputStream stream, AnnotationInstance annotation) throws IOException
writeReferenceOrFullback to summary
private void writeReferenceOrFull(PackedDataOutputStream stream, Type[] types) throws IOException
writeStringTableback to summary
private void writeStringTable(PackedDataOutputStream stream) throws IOException
writeTypeEntryback to summary
private void writeTypeEntry(PackedDataOutputStream stream, Type type) throws IOException
writeTypeListEntryback to summary
private void writeTypeListEntry(PackedDataOutputStream stream, Type[] types) throws IOException
writeTypeListTableback to summary
private void writeTypeListTable(PackedDataOutputStream stream) throws IOException
writeTypeTableback to summary
private void writeTypeTable(PackedDataOutputStream stream) throws IOException
writeTypeTargetback to summary
private void writeTypeTarget(PackedDataOutputStream stream, TypeTarget typeTarget) throws IOException
writeTypeTargetFieldsback to summary
private void writeTypeTargetFields(PackedDataOutputStream stream, byte tag, TypeTarget target) throws IOException
writeUsersSetback to summary
private void writeUsersSet(PackedDataOutputStream stream, DotName user, List<ClassInfo> uses) throws IOException
writeUsersTableback to summary
private void writeUsersTable(PackedDataOutputStream stream, Map<DotName, List<ClassInfo>> users) throws IOException
org.jboss.jandex back to summary

pack-priv Class IndexWriterV2.ReferenceEntry

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private boolean

Constructor Summary

AccessConstructor and Description
pack-priv
ReferenceEntry(int index)

Method Summary

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

indexback to summary
private int index
writtenback to summary
private boolean written

Constructor Detail

ReferenceEntryback to summary
pack-priv ReferenceEntry(int index)
org.jboss.jandex back to summary

pack-priv Class IndexWriterV2.ReferenceTable<T>

extends Object
Class Inheritance

Field Summary

Modifier and TypeField and Description
private int
private IdentityHashMap<T, IndexWriterV2.ReferenceEntry>
private List<T>

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv void
addReference(T reference)

private IndexWriterV2.ReferenceEntry
getReferenceEntry(T reference)

pack-priv List<T>
list()

pack-priv boolean
markWritten(T reference)

pack-priv int
positionOf(T reference)

pack-priv int
size()

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

counterback to summary
private int counter
referencesback to summary
private IdentityHashMap<T, IndexWriterV2.ReferenceEntry> references
tableback to summary
private List<T> table

Constructor Detail

ReferenceTableback to summary
pack-priv ReferenceTable()

Method Detail

addReferenceback to summary
pack-priv void addReference(T reference)
getReferenceEntryback to summary
private IndexWriterV2.ReferenceEntry getReferenceEntry(T reference)
listback to summary
pack-priv List<T> list()
markWrittenback to summary
pack-priv boolean markWritten(T reference)
positionOfback to summary
pack-priv int positionOf(T reference)
sizeback to summary
pack-priv int size()