public class JarBuilder
extends java.lang.Object
Constructor and Description |
---|
JarBuilder(java.io.File file)
Creates a file file without a manifest
|
JarBuilder(java.io.File jar,
java.io.File manifest)
Creates an empty jar file with the given manifest
|
JarBuilder(java.io.File jar,
java.util.jar.Manifest manifest)
Creates an empty jar file with the given manifest
|
Modifier and Type | Method and Description |
---|---|
void |
addDirectoryRecursive(java.io.File dir,
java.lang.String parent)
Add the directory into the directory specified by parent
|
void |
addDirectoryRecursive(java.io.File dir,
java.lang.String parent,
java.io.FileFilter filter)
Add the directory into the directory specified by parent
|
void |
addFile(java.io.File file,
java.lang.String parent,
java.lang.String fileName)
Adds the file to the given path and name
|
void |
close()
Close writing on the jar file
|
boolean |
makeDirectory(java.lang.String parent,
java.lang.String dirName)
Makes a directory in the jar file
|
public JarBuilder(java.io.File file) throws java.io.IOException
file
- the file to write the jar tojava.io.IOException
- thrown if the file cannot be opened for writingpublic JarBuilder(java.io.File jar, java.io.File manifest) throws java.io.IOException
jar
- the file to write the jar tomanifest
- the file that is the manifest for the archivejava.io.IOException
- thrown if either file cannot be opened for readingpublic JarBuilder(java.io.File jar, java.util.jar.Manifest manifest)
jar
- the file to write the jar tomanifest
- the manifest file for the jarManifestWriter
public void addFile(java.io.File file, java.lang.String parent, java.lang.String fileName) throws java.io.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 archivejava.io.IOException
public void addDirectoryRecursive(java.io.File dir, java.lang.String parent)
dir
- the directory to addparent
- the path inside the jar that the directory should be added topublic void addDirectoryRecursive(java.io.File dir, java.lang.String parent, java.io.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(java.lang.String parent, java.lang.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 java.io.IOException
java.io.IOException