public class MyZip
extends java.lang.Object
Constructor and Description |
---|
MyZip() |
Modifier and Type | Method and Description |
---|---|
static void |
zip(java.io.File file,
java.util.zip.ZipOutputStream zos)
Zips the given file to the given ZipOutputStream.
|
static void |
zip(java.io.File file,
java.util.zip.ZipOutputStream zos,
java.io.File relativeRoot)
Zips the given file to the given ZipOutputStream.
|
static void |
zipFilesAndDirectories(java.lang.String zipDirectory,
java.util.zip.ZipOutputStream zos,
java.io.File relativeRoot)
Zips the entire contents of the named zipDirectory to the given ZipOutputStream.
|
public static void zip(java.io.File file, java.util.zip.ZipOutputStream zos) throws java.io.IOException
file
- The file to add to the given zip OutputStream. The file cannot represent a directory in the file system.zos
- The output stream to zip the file tojava.io.IOException
- -public static void zip(java.io.File file, java.util.zip.ZipOutputStream zos, java.io.File relativeRoot) throws java.io.IOException
file
- The file to add to the given zip OutputStream. The file cannot represent a directory in the file system.zos
- The output stream to zip the file torelativeRoot
- The relative root to consider when determining the name for the zip entry using which the file will be added to the zipjava.io.IOException
- -public static void zipFilesAndDirectories(java.lang.String zipDirectory, java.util.zip.ZipOutputStream zos, java.io.File relativeRoot) throws java.io.IOException
zipDirectory
- the name of the directory the contents of which are to be zippedzos
- The output stream to zip the file torelativeRoot
- The relative root to consider when determining the name for the zip entry using which the file will be added to the zipjava.io.IOException
- -