Class JarIndexer

java.lang.Object
org.jboss.jandex.JarIndexer

public class JarIndexer extends Object
Class which contains utility methods to create an index for a jar file
  • Constructor Details

    • JarIndexer

      private JarIndexer()
  • Method Details

    • getIndexFile

      private static File getIndexFile(File jarFile, boolean newJar)
    • createJarIndex

      public static Result createJarIndex(File jarFile, Indexer indexer, boolean modify, boolean newJar, boolean verbose) throws IOException
      Indexes a jar file and saves the result. If the modify flag is set, index is saved to META-INF/jandex.idx. Otherwise an external file is created with a similar name to the original file, concatenating .idx suffix.
      Parameters:
      jarFile - The file to index
      indexer - The indexer to use
      modify - If the original jar should be modified
      newJar - If the new jar should be created
      verbose - If we should print what we are doing to standard out
      Returns:
      indexing result
      Throws:
      IOException - for any I/o error
    • createJarIndex

      public static Result createJarIndex(File jarFile, Indexer indexer, File outputFile, boolean modify, boolean newJar, boolean verbose) throws IOException
      Indexes a jar file and saves the result. If the modify flag is set, index is saved to META-INF/jandex.idx. Otherwise an external file is created with a similar name to the original file, concatenating .idx suffix.
      Parameters:
      jarFile - The file to index
      indexer - The indexer to use
      outputFile - The index file to write to
      modify - If the original jar should be modified
      newJar - If the new jar should be created
      verbose - If we should print what we are doing to standard out
      Returns:
      indexing result
      Throws:
      IOException - for any I/o error
    • createJarIndex

      public static Result createJarIndex(File jarFile, Indexer indexer, boolean modify, boolean newJar, boolean verbose, PrintStream infoStream, PrintStream errStream) throws IOException
      Indexes a jar file and saves the result. If the modify flag is set, index is saved to META-INF/jandex.idx. Otherwise an external file is created with a similar name to the original file, concatenating .idx suffix.
      Parameters:
      jarFile - The file to index
      indexer - The indexer to use
      modify - If the original jar should be modified
      newJar - If the new jar should be created
      verbose - If we should print what we are doing to the specified info stream
      infoStream - A print stream which will record verbose info, may be null
      errStream - A print stream to print errors, must not be null
      Returns:
      indexing result
      Throws:
      IOException - for any I/o error
    • createJarIndex

      public static Result createJarIndex(File jarFile, Indexer indexer, File outputFile, boolean modify, boolean newJar, boolean verbose, PrintStream infoStream, PrintStream errStream) throws IOException
      Indexes a jar file and saves the result. If the modify flag is set, index is saved to META-INF/jandex.idx. Otherwise an external file is created with a similar name to the original file, concatenating .idx suffix.
      Parameters:
      jarFile - The file to index
      indexer - The indexer to use
      outputFile - The index file to write to
      modify - If the original jar should be modified
      newJar - If the new jar should be created
      verbose - If we should print what we are doing to the specified info stream
      infoStream - A print stream which will record verbose info, may be null
      errStream - A print stream to print errors, must not be null
      Returns:
      indexing result
      Throws:
      IOException - for any I/o error
    • copy

      private static void copy(File dest, File source) throws IOException
      Throws:
      IOException
    • printIndexEntryInfo

      private static void printIndexEntryInfo(ClassSummary info, PrintStream infoStream)
    • copy

      private static void copy(InputStream in, OutputStream out) throws IOException
      Throws:
      IOException
    • safeClose

      private static void safeClose(JarFile close)
    • safeClose

      private static void safeClose(Closeable close)