Package org.jboss.jandex
Class JarIndexer
- java.lang.Object
-
- org.jboss.jandex.JarIndexer
-
public class JarIndexer extends java.lang.Object
Class which contains utility methods to create an index for a jar file
-
-
Constructor Summary
Constructors Modifier Constructor Description private
JarIndexer()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static void
copy(java.io.File dest, java.io.File source)
private static void
copy(java.io.InputStream in, java.io.OutputStream out)
static Result
createJarIndex(java.io.File jarFile, Indexer indexer, boolean modify, boolean newJar, boolean verbose)
Indexes a jar file and saves the result.static Result
createJarIndex(java.io.File jarFile, Indexer indexer, boolean modify, boolean newJar, boolean verbose, java.io.PrintStream infoStream, java.io.PrintStream errStream)
Indexes a jar file and saves the result.static Result
createJarIndex(java.io.File jarFile, Indexer indexer, java.io.File outputFile, boolean modify, boolean newJar, boolean verbose)
Indexes a jar file and saves the result.static Result
createJarIndex(java.io.File jarFile, Indexer indexer, java.io.File outputFile, boolean modify, boolean newJar, boolean verbose, java.io.PrintStream infoStream, java.io.PrintStream errStream)
Indexes a jar file and saves the result.private static java.io.File
getIndexFile(java.io.File jarFile, boolean newJar)
private static void
printIndexEntryInfo(ClassInfo info, java.io.PrintStream infoStream)
private static void
safeClose(java.io.Closeable close)
private static void
safeClose(java.util.jar.JarFile close)
-
-
-
Method Detail
-
getIndexFile
private static java.io.File getIndexFile(java.io.File jarFile, boolean newJar)
-
createJarIndex
public static Result createJarIndex(java.io.File jarFile, Indexer indexer, boolean modify, boolean newJar, boolean verbose) throws java.io.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 indexindexer
- The indexer to usemodify
- If the original jar should be modifiednewJar
- If the new jar should be createdverbose
- If we should print what we are doing to standard out- Returns:
- indexing result
- Throws:
java.io.IOException
- for any I/o error
-
createJarIndex
public static Result createJarIndex(java.io.File jarFile, Indexer indexer, java.io.File outputFile, boolean modify, boolean newJar, boolean verbose) throws java.io.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 indexindexer
- The indexer to useoutputFile
- The index file to write tomodify
- If the original jar should be modifiednewJar
- If the new jar should be createdverbose
- If we should print what we are doing to standard out- Returns:
- indexing result
- Throws:
java.io.IOException
- for any I/o error
-
createJarIndex
public static Result createJarIndex(java.io.File jarFile, Indexer indexer, boolean modify, boolean newJar, boolean verbose, java.io.PrintStream infoStream, java.io.PrintStream errStream) throws java.io.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 indexindexer
- The indexer to usemodify
- If the original jar should be modifiednewJar
- If the new jar should be createdverbose
- If we should print what we are doing to the specified info streaminfoStream
- A print stream which will record verbose info, may be nullerrStream
- A print stream to print errors, must not be null- Returns:
- indexing result
- Throws:
java.io.IOException
- for any I/o error
-
createJarIndex
public static Result createJarIndex(java.io.File jarFile, Indexer indexer, java.io.File outputFile, boolean modify, boolean newJar, boolean verbose, java.io.PrintStream infoStream, java.io.PrintStream errStream) throws java.io.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 indexindexer
- The indexer to useoutputFile
- The index file to write tomodify
- If the original jar should be modifiednewJar
- If the new jar should be createdverbose
- If we should print what we are doing to the specified info streaminfoStream
- A print stream which will record verbose info, may be null 1errStream
- A print stream to print errors, must not be null- Returns:
- indexing result
- Throws:
java.io.IOException
- for any I/o error
-
copy
private static void copy(java.io.File dest, java.io.File source) throws java.io.IOException
- Throws:
java.io.IOException
-
printIndexEntryInfo
private static void printIndexEntryInfo(ClassInfo info, java.io.PrintStream infoStream)
-
copy
private static void copy(java.io.InputStream in, java.io.OutputStream out) throws java.io.IOException
- Throws:
java.io.IOException
-
safeClose
private static void safeClose(java.util.jar.JarFile close)
-
safeClose
private static void safeClose(java.io.Closeable close)
-
-