|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.maven.shared.jar.JarAnalyzer
public class JarAnalyzer
Open a JAR file to be analyzed. Note that once created, the closeQuietly()
method should be called to
release the associated file handle.
JarAnalyzer jar = new JarAnalyzer( jarFile ); try { // do some analysis, such as: jarClasses = jarClassAnalyzer.analyze( jar ); } finally { jar.closeQuietly(); } // use jar.getJarData() in some way, or the data returned by the JAR analyzer. jar itself can no longer be used.Note: that the actual data is separated from this class by design to minimise the chance of forgetting to close the JAR file. The
JarData
class exposed, as well as any data returned by actual
analyzers that use this class, can be used safely once this class is out of scope.
JarIdentificationAnalysis.analyze(JarAnalyzer)
,
JarClassesAnalysis.analyze(JarAnalyzer)
Constructor Summary | |
---|---|
JarAnalyzer(File file)
Constructor. |
Method Summary | |
---|---|
void |
closeQuietly()
Close the associated JAR file, ignoring any errors that may occur. |
List |
filterEntries(Pattern pattern)
Filter a list of JAR entries against the pattern. |
List |
getClassEntries()
Get all the classes in the JAR. |
List |
getEntries()
Get all the contained files in the JAR. |
InputStream |
getEntryInputStream(JarEntry entry)
Get the data for an individual entry in the JAR. |
File |
getFile()
Get the file that was opened by this analyzer. |
JarData |
getJarData()
|
List |
getMavenPomEntries()
Get all the Maven POM entries in the JAR. |
List |
getVersionEntries()
Get all the version text files in the JAR. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public JarAnalyzer(File file) throws IOException
closeQuietly()
.
file
- the JAR file to open
IOException
- if there is a problem opening the JAR file, or reading the manifest. The JAR file will be closed if this occurs.Method Detail |
---|
public InputStream getEntryInputStream(JarEntry entry) throws IOException
entry
- the JAR entry to read from
IOException
- if there is a problem opening the individual entrypublic void closeQuietly()
public List filterEntries(Pattern pattern)
pattern
- the pattern to filter against
JarEntry
elementspublic List getClassEntries()
JarEntry
elementspublic List getMavenPomEntries()
JarEntry
elementspublic List getVersionEntries()
JarEntry
elementspublic List getEntries()
JarEntry
elementspublic File getFile()
public JarData getJarData()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |