Class 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 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

      • IndexWriterV1

        IndexWriterV1​(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
      • 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
      • writeType

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

        private void buildTables​(Index index)
      • intern

        private java.lang.String intern​(java.lang.String name)
      • addClassName

        private void addClassName​(DotName name)