
Public Member Functions | |
| JarSourceExtractor () | |
| void | extractJavaSourcesToFiles (JarFile jarfile, File outDir) throws IOException |
| void | extractJavaSourcesToJar (JarFile jarfile, JarOutputStream jarOut) throws IOException |
| JarEntry[] | getJavaEntries (JarFile jarfile) |
Static Public Attributes | |
| static final String[] | PREFIX_PATHS = new String[] {"src", "test"} |
Package Functions | |
| void | extract (JarFile jarfile, JarEntry entry, OutputStream out) throws IOException |
Private Member Functions | |
| String | getClassName (JarEntry javaEntry) |
| alma::acs::makesupport::JarSourceExtractor::JarSourceExtractor | ( | ) | [inline] |
| void alma::acs::makesupport::JarSourceExtractor::extract | ( | JarFile | jarfile, | |
| JarEntry | entry, | |||
| OutputStream | out | |||
| ) | throws IOException [inline, package] |
Extracts a file from a JAR file and writes it to an output stream. Does not close the output stream.
| jarfile | the jarfile from which to extract a file | |
| entry | the entry (file) to be extracted from the jar file | |
| out | the stream to write the entry to |
| IOException | if the Jar file can't be read or the out stream can't be written to |
Referenced by extractJavaSourcesToFiles(), and extractJavaSourcesToJar().
| void alma::acs::makesupport::JarSourceExtractor::extractJavaSourcesToFiles | ( | JarFile | jarfile, | |
| File | outDir | |||
| ) | throws IOException [inline] |
Extracts Java source files from a JAR file and puts them as individual files under a given directory.
| jarfile | jar file from which Java source will be extracted | |
| outDir | root dir under which the extracted java files will be placed |
| IOException |
References extract(), getClassName(), and getJavaEntries().
Referenced by alma::acs::makesupport::AcsFileFinderTest::testExtractor().
| void alma::acs::makesupport::JarSourceExtractor::extractJavaSourcesToJar | ( | JarFile | jarfile, | |
| JarOutputStream | jarOut | |||
| ) | throws IOException [inline] |
Extracts Java source files from a JAR file and adds them to another JAR file.
| jarfile | jar file from which Java source will be extracted | |
| jarOut | JAR output stream to which the extracted java files will be written; jarOut is left open by this method, so that the client can either call it again, or call jarOut.close() when it's done. (there are problems with re-opening and adding entries to a Jar file.) |
| IOException |
References extract(), getClassName(), and getJavaEntries().
Referenced by alma::acs::makesupport::JarSourceExtractorRunner::main(), and alma::acs::makesupport::AcsFileFinderTest::testExtractor().
| String alma::acs::makesupport::JarSourceExtractor::getClassName | ( | JarEntry | javaEntry | ) | [inline, private] |
Gets the Java class name from a JarEntry.
Uses PREFIX_PATHS to remove a leading prefix path that is not part of the Java package.
| javaEntry |
References PREFIX_PATHS.
Referenced by extractJavaSourcesToFiles(), and extractJavaSourcesToJar().
| JarEntry [] alma::acs::makesupport::JarSourceExtractor::getJavaEntries | ( | JarFile | jarfile | ) | [inline] |
Lists all Java source files that are contained inside a given JAR file.
The current implementation only looks for a ".java" file ending, ignoring the contents of such files.
| jarfile | the JAR file to be searched |
Referenced by extractJavaSourcesToFiles(), and extractJavaSourcesToJar().
final String [] alma::acs::makesupport::JarSourceExtractor::PREFIX_PATHS = new String[] {"src", "test"} [static] |
prefix paths inside JAR files which are not considered part of Java package paths
Referenced by getClassName().
1.6.2