Class IndexWriter


  • public final class IndexWriter
    extends java.lang.Object
    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
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private java.io.OutputStream out  
    • Constructor Summary

      Constructors 
      Constructor Description
      IndexWriter​(java.io.OutputStream out)
      Constructs an IndexWriter using the specified stream
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private IndexWriterImpl getWriter​(int version)  
      int write​(Index index)
      Writes the specified index to the associated output stream.
      int write​(Index index, byte version)
      Deprecated.
      int write​(Index index, int version)
      Writes the specified index to the associated output stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • out

        private final java.io.OutputStream out
    • Constructor Detail

      • IndexWriter

        public IndexWriter​(java.io.OutputStream out)
        Constructs an IndexWriter using the specified stream
        Parameters:
        out - a stream to write an index to
    • Method Detail

      • write

        public 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. The default version of index file is used.
        Parameters:
        index - the index to write to the stream
        Returns:
        the number of bytes written to the stream
        Throws:
        java.io.IOException - if the underlying stream fails
      • write

        @Deprecated
        public int write​(Index index,
                         byte version)
                  throws java.io.IOException
        Deprecated.
        Writes the specified index to the associated output stream. This may be called multiple times in order to write multiple indexes.
        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
      • write

        public 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.
        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