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 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 java.util.TreeMap<DotName,java.lang.Integer>
classTable
private static byte
FIELD_TAG
private static int
MAGIC
(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.io.OutputStream
out
private StrongInternPool<java.lang.String>
pool
(package private) StrongInternPool.Index
poolIndex
-
Constructor Summary
Constructors Constructor Description IndexWriterV1(java.io.OutputStream out)
Constructs an IndexWriter using the specified stream
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addClassName(DotName name)
private void
buildAValueEntries(Index index, AnnotationValue value)
private void
buildTables(Index index)
private DotName
downgradeName(DotName name)
private java.lang.String
intern(java.lang.String name)
private int
positionOf(java.lang.String string)
private int
positionOf(DotName className)
(package private) int
write(Index index, int version)
Writes the specified index to the associated output stream.private void
writeAnnotationValue(PackedDataOutputStream stream, AnnotationValue value)
private void
writeAnnotationValues(PackedDataOutputStream stream, java.util.Collection<AnnotationValue> values)
private void
writeClasses(PackedDataOutputStream stream, Index index, int version)
private void
writeClassTable(PackedDataOutputStream stream)
private void
writeStringTable(PackedDataOutputStream stream)
private void
writeType(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
-
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, int version) 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:
write
in 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, int version) 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)
-
-