Class IndexWriterV2


  • final class IndexWriterV2
    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 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:
    Indexer, Index
    • Constructor Detail

      • IndexWriterV2

        IndexWriterV2​(java.io.OutputStream out)
        Constructs an IndexWriter using the specified stream
        Parameters:
        out - a stream to write an index to
    • 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 class IndexWriterImpl
        Parameters:
        index - the index to write to the stream
        version - the index file version
        Returns:
        the number of bytes written to the stream
        Throws:
        java.io.IOException - if any i/o error occurs
      • writeUsersTable

        private void writeUsersTable​(PackedDataOutputStream stream,
                                     java.util.Map<DotName,​java.util.List<ClassInfo>> users)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeStringTable

        private void writeStringTable​(PackedDataOutputStream stream)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writeByteTable

        private void writeByteTable​(PackedDataOutputStream stream)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTypeTable

        private void writeTypeTable​(PackedDataOutputStream stream)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTypeListTable

        private void writeTypeListTable​(PackedDataOutputStream stream)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTypeListEntry

        private void writeTypeListEntry​(PackedDataOutputStream stream,
                                        Type[] types)
                                 throws java.io.IOException
        Throws:
        java.io.IOException
      • writeMethodTable

        private void writeMethodTable​(PackedDataOutputStream stream,
                                      int version)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writeFieldTable

        private void writeFieldTable​(PackedDataOutputStream stream)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeRecordComponentTable

        private void writeRecordComponentTable​(PackedDataOutputStream stream)
                                        throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTypeTarget

        private void writeTypeTarget​(PackedDataOutputStream stream,
                                     TypeTarget typeTarget)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTypeTargetFields

        private void writeTypeTargetFields​(PackedDataOutputStream stream,
                                           byte tag,
                                           TypeTarget target)
                                    throws java.io.IOException
        Throws:
        java.io.IOException
      • writeNameTable

        private void writeNameTable​(PackedDataOutputStream stream)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • positionOf

        private int positionOf​(java.lang.String string)
      • positionOf

        private int positionOf​(byte[] bytes)
      • positionOf

        private int positionOf​(DotName className)
      • positionOf

        private int positionOf​(Type type)
      • positionOf

        private int positionOf​(Type[] types)
      • markWritten

        private boolean markWritten​(Type[] types)
      • writeClasses

        private void writeClasses​(PackedDataOutputStream stream,
                                  Index index,
                                  int version)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • writeModules

        private void writeModules​(PackedDataOutputStream stream,
                                  Index index,
                                  int version)
                           throws java.io.IOException
        Throws:
        java.io.IOException
      • writeClassEntry

        private void writeClassEntry​(PackedDataOutputStream stream,
                                     ClassInfo clazz,
                                     int version)
                              throws java.io.IOException
        Throws:
        java.io.IOException
      • writeModuleEntry

        private void writeModuleEntry​(PackedDataOutputStream stream,
                                      ModuleInfo module,
                                      int version)
                               throws java.io.IOException
        Throws:
        java.io.IOException
      • writeDotNames

        private void writeDotNames​(PackedDataOutputStream stream,
                                   java.util.List<DotName> names)
                            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
      • writeReference

        private void writeReference​(PackedDataOutputStream stream,
                                    Type type,
                                    boolean nullable)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • writeReferenceOrFull

        private void writeReferenceOrFull​(PackedDataOutputStream stream,
                                          Type[] types)
                                   throws java.io.IOException
        Throws:
        java.io.IOException
      • writeTypeEntry

        private void writeTypeEntry​(PackedDataOutputStream stream,
                                    Type type)
                             throws java.io.IOException
        Throws:
        java.io.IOException
      • buildTables

        private void buildTables​(Index index,
                                 int version)
      • addClass

        private void addClass​(ClassInfo clazz)
      • addModule

        private void addModule​(ModuleInfo module)
      • addAnnotationTarget

        private void addAnnotationTarget​(AnnotationTarget target)
      • addFieldList

        private void addFieldList​(FieldInternal[] fields)
      • addMethodList

        private void addMethodList​(MethodInternal[] methods)
      • addTypeList

        private void addTypeList​(Type[] types)
      • addType

        private void addType​(Type type)
      • buildAValueEntries

        private void buildAValueEntries​(AnnotationValue value)
      • addNullableString

        private java.lang.String addNullableString​(java.lang.String name)
      • addString

        private java.lang.String addString​(java.lang.String name)
      • addClassNames

        private void addClassNames​(java.util.List<DotName> names)
      • addClassName

        private void addClassName​(DotName name)