Top Description Constructors Methods
org.jboss.jandex

public Class JarIndexer

extends Object
Class Inheritance
Imports
java.io.*, java.util.Enumeration, java.util.jar.JarEntry, .JarFile, java.util.zip.ZipEntry, .ZipOutputStream

Class which contains utility methods to create an index for a jar file
Authors
Stuart Douglas, Jason T. Greene, Ales Justin

Constructor Summary

AccessConstructor and Description
private

Method Summary

Modifier and TypeMethod and Description
private static void
copy(File dest, File source)

private static void
public static Result

Returns:

indexing result
createJarIndex
(File
The file to index
jarFile
,
Indexer
The indexer to use
indexer
,
boolean
If the original jar should be modified
modify
,
boolean
If the new jar should be created
newJar
,
boolean
If we should print what we are doing to standard out
verbose
)

Indexes a jar file and saves the result.

public static Result

Returns:

indexing result
createJarIndex
(File
The file to index
jarFile
,
Indexer
The indexer to use
indexer
,
File
The index file to write to
outputFile
,
boolean
If the original jar should be modified
modify
,
boolean
If the new jar should be created
newJar
,
boolean
If we should print what we are doing to standard out
verbose
)

Indexes a jar file and saves the result.

public static Result

Returns:

indexing result
createJarIndex
(File
The file to index
jarFile
,
Indexer
The indexer to use
indexer
,
boolean
If the original jar should be modified
modify
,
boolean
If the new jar should be created
newJar
,
boolean
If we should print what we are doing to the specified info stream
verbose
,
PrintStream
A print stream which will record verbose info, may be null
infoStream
,
PrintStream
A print stream to print errors, must not be null
errStream
)

Indexes a jar file and saves the result.

public static Result

Returns:

indexing result
createJarIndex
(File
The file to index
jarFile
,
Indexer
The indexer to use
indexer
,
File
The index file to write to
outputFile
,
boolean
If the original jar should be modified
modify
,
boolean
If the new jar should be created
newJar
,
boolean
If we should print what we are doing to the specified info stream
verbose
,
PrintStream
A print stream which will record verbose info, may be null
infoStream
,
PrintStream
A print stream to print errors, must not be null
errStream
)

Indexes a jar file and saves the result.

private static File
getIndexFile(File jarFile, boolean newJar)

private static void
private static void
private static void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Constructor Detail

JarIndexerback to summary
private JarIndexer()

Method Detail

copyback to summary
private static void copy(File dest, File source) throws IOException
copyback to summary
private static void copy(InputStream in, OutputStream out) throws IOException
createJarIndexback to summary
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:File

The file to index

indexer:Indexer

The indexer to use

modify:boolean

If the original jar should be modified

newJar:boolean

If the new jar should be created

verbose:boolean

If we should print what we are doing to standard out

Returns:Result

indexing result

Exceptions
IOException:
for any I/o error
createJarIndexback to summary
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:File

The file to index

indexer:Indexer

The indexer to use

outputFile:File

The index file to write to

modify:boolean

If the original jar should be modified

newJar:boolean

If the new jar should be created

verbose:boolean

If we should print what we are doing to standard out

Returns:Result

indexing result

Exceptions
IOException:
for any I/o error
createJarIndexback to summary
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:File

The file to index

indexer:Indexer

The indexer to use

modify:boolean

If the original jar should be modified

newJar:boolean

If the new jar should be created

verbose:boolean

If we should print what we are doing to the specified info stream

infoStream:PrintStream

A print stream which will record verbose info, may be null

errStream:PrintStream

A print stream to print errors, must not be null

Returns:Result

indexing result

Exceptions
IOException:
for any I/o error
createJarIndexback to summary
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:File

The file to index

indexer:Indexer

The indexer to use

outputFile:File

The index file to write to

modify:boolean

If the original jar should be modified

newJar:boolean

If the new jar should be created

verbose:boolean

If we should print what we are doing to the specified info stream

infoStream:PrintStream

A print stream which will record verbose info, may be null

errStream:PrintStream

A print stream to print errors, must not be null

Returns:Result

indexing result

Exceptions
IOException:
for any I/o error
getIndexFileback to summary
private static File getIndexFile(File jarFile, boolean newJar)
printIndexEntryInfoback to summary
private static void printIndexEntryInfo(ClassSummary info, PrintStream infoStream)
safeCloseback to summary
private static void safeClose(JarFile close)
safeCloseback to summary
private static void safeClose(Closeable close)