Package edu.rice.cs.util.jar
Class JarBuilder
java.lang.Object
edu.rice.cs.util.jar.JarBuilder
-
Constructor Summary
ConstructorDescriptionJarBuilder
(File file) Creates a file file without a manifestJarBuilder
(File jar, File manifest) Creates an empty jar file with the given manifestJarBuilder
(File jar, Manifest manifest) Creates an empty jar file with the given manifest -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDirectoryRecursive
(File dir, String parent) Add the directory into the directory specified by parentvoid
addDirectoryRecursive
(File dir, String parent, FileFilter filter) Add the directory into the directory specified by parentvoid
Adds the file to the given path and namevoid
close()
Close writing on the jar fileboolean
makeDirectory
(String parent, String dirName) Makes a directory in the jar file
-
Constructor Details
-
JarBuilder
Creates a file file without a manifest- Parameters:
file
- the file to write the jar to- Throws:
IOException
- thrown if the file cannot be opened for writing
-
JarBuilder
Creates an empty jar file with the given manifest- Parameters:
jar
- the file to write the jar tomanifest
- the file that is the manifest for the archive- Throws:
IOException
- thrown if either file cannot be opened for reading
-
JarBuilder
Creates an empty jar file with the given manifest- Parameters:
jar
- the file to write the jar tomanifest
- the manifest file for the jar- See Also:
-
ManifestWriter
-
-
Method Details
-
addFile
Adds the file to the given path and name- Parameters:
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 archive- Throws:
IOException
-
addDirectoryRecursive
Add the directory into the directory specified by parent- Parameters:
dir
- the directory to addparent
- the path inside the jar that the directory should be added to
-
addDirectoryRecursive
Add the directory into the directory specified by parent- Parameters:
dir
- the directory to addparent
- the path inside the jar that the directory should be added tofilter
- the filter used to filter the files
-
makeDirectory
Makes a directory in the jar file- Parameters:
parent
- The name of the parent that the directory is to be created indirName
- The name of the directory to be created- Returns:
- Returns true on success, false on failure
-
close
Close writing on the jar file- Throws:
IOException
-