Package org.jboss.jandex
Class IndexWriterV1
- java.lang.Object
-
- org.jboss.jandex.IndexWriterImpl
-
- org.jboss.jandex.IndexWriterV1
-
final class IndexWriterV1 extends IndexWriterImpl
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 onIndexer.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.
-
-
Field Summary
Fields Modifier and Type Field Description private static intAVALUE_ARRAYprivate static intAVALUE_BOOLEANprivate static intAVALUE_BYTEprivate static intAVALUE_CHARprivate static intAVALUE_CLASSprivate static intAVALUE_DOUBLEprivate static intAVALUE_ENUMprivate static intAVALUE_FLOATprivate static intAVALUE_INTprivate static intAVALUE_LONGprivate static intAVALUE_NESTEDprivate static intAVALUE_SHORTprivate static intAVALUE_STRINGprivate static byteCLASS_TAGprivate java.util.TreeMap<DotName,java.lang.Integer>classTableprivate static byteFIELD_TAGprivate static intMAGIC(package private) static intMAX_VERSIONprivate static byteMETHOD_PARAMETER_TAGprivate static byteMETHOD_TAG(package private) static intMIN_VERSIONprivate java.io.OutputStreamoutprivate StrongInternPool<java.lang.String>pool(package private) StrongInternPool.IndexpoolIndexprivate intversion
-
Constructor Summary
Constructors Constructor Description IndexWriterV1(java.io.OutputStream out, int version)Constructs an IndexWriter using the specified stream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private voidaddClassName(DotName name)private voidbuildAValueEntries(Index index, AnnotationValue value)private voidbuildTables(Index index)private DotNamedowngradeName(DotName name)private java.lang.Stringintern(java.lang.String name)private intpositionOf(java.lang.String string)private intpositionOf(DotName className)(package private) intwrite(Index index)Writes the specified index to the associated output stream.private voidwriteAnnotationValue(PackedDataOutputStream stream, AnnotationValue value)private voidwriteAnnotationValues(PackedDataOutputStream stream, java.util.Collection<AnnotationValue> values)private voidwriteClasses(PackedDataOutputStream stream, Index index)private voidwriteClassTable(PackedDataOutputStream stream)private voidwriteStringTable(PackedDataOutputStream stream)private voidwriteType(PackedDataOutputStream stream, Type type)
-
-
-
Field Detail
-
MAGIC
private static final int MAGIC
- See Also:
- Constant Field Values
-
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
-
out
private final java.io.OutputStream out
-
version
private final int version
-
pool
private StrongInternPool<java.lang.String> pool
-
poolIndex
StrongInternPool.Index poolIndex
-
classTable
private java.util.TreeMap<DotName,java.lang.Integer> classTable
-
-
Method Detail
-
write
int write(Index index) throws java.io.IOException
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 streamversion- the index file version- Returns:
- the number of bytes written to the stream
- Throws:
java.io.IOException- if any i/o error occurs
-
writeStringTable
private void writeStringTable(PackedDataOutputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
writeClassTable
private void writeClassTable(PackedDataOutputStream stream) throws java.io.IOException
- Throws:
java.io.IOException
-
positionOf
private int positionOf(java.lang.String string)
-
positionOf
private int positionOf(DotName className)
-
writeClasses
private void writeClasses(PackedDataOutputStream stream, Index index) throws java.io.IOException
- Throws:
java.io.IOException
-
writeAnnotationValues
private void writeAnnotationValues(PackedDataOutputStream stream, java.util.Collection<AnnotationValue> values) throws java.io.IOException
- Throws:
java.io.IOException
-
writeAnnotationValue
private void writeAnnotationValue(PackedDataOutputStream stream, AnnotationValue value) throws java.io.IOException
- Throws:
java.io.IOException
-
writeType
private void writeType(PackedDataOutputStream stream, Type type) throws java.io.IOException
- Throws:
java.io.IOException
-
buildTables
private void buildTables(Index index)
-
buildAValueEntries
private void buildAValueEntries(Index index, AnnotationValue value)
-
intern
private java.lang.String intern(java.lang.String name)
-
addClassName
private void addClassName(DotName name)
-
-