public class JarBuilder extends Object
| Constructor and Description |
|---|
JarBuilder(File file)
Creates a file file without a manifest
|
JarBuilder(File jar,
File manifest)
Creates an empty jar file with the given manifest
|
JarBuilder(File jar,
Manifest manifest)
Creates an empty jar file with the given manifest
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDirectoryRecursive(File dir,
String parent)
Add the directory into the directory specified by parent
|
void |
addDirectoryRecursive(File dir,
String parent,
FileFilter filter)
Add the directory into the directory specified by parent
|
void |
addFile(File file,
String parent,
String fileName)
Adds the file to the given path and name
|
void |
close()
Close writing on the jar file
|
boolean |
makeDirectory(String parent,
String dirName)
Makes a directory in the jar file
|
public JarBuilder(File file) throws IOException
file - the file to write the jar toIOException - thrown if the file cannot be opened for writingpublic JarBuilder(File jar, File manifest) throws IOException
jar - the file to write the jar tomanifest - the file that is the manifest for the archiveIOException - thrown if either file cannot be opened for readingpublic void addFile(File file, String parent, String fileName) throws IOException
file - the file to be addedparent - the directory to the path in which the file is to be addedfileName - the name of the file in the archiveIOExceptionpublic void addDirectoryRecursive(File dir, String parent)
dir - the directory to addparent - the path inside the jar that the directory should be added topublic void addDirectoryRecursive(File dir, String parent, FileFilter filter)
dir - the directory to addparent - the path inside the jar that the directory should be added tofilter - the filter used to filter the filespublic boolean makeDirectory(String parent, String dirName)
parent - The name of the parent that the directory is to be created indirName - The name of the directory to be createdpublic void close()
throws IOException
IOException