public final class ZipUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static int |
BEST_COMPRESSION |
static int |
BEST_SPEED |
static int |
DEFAULT_COMPRESSION |
static int |
NO_COMPRESSION |
| Modifier and Type | Method and Description |
|---|---|
static void |
unzip(File zipFile,
File destination)
Extracts a zip file to a directory.
|
static void |
unzip(File zipFile,
String destination)
Extracts a zip file to a directory.
|
static void |
unzip(String zipFile,
File destination)
Extracts a zip file to a directory.
|
static void |
unzip(String zipFile,
String destination)
Extracts a zip file to a directory.
|
static File |
zip(File[] sourceFiles,
File destination)
Compresses source files into a zip archive (no recursive, default compression)
|
static File |
zip(File[] sourceFiles,
File destination,
boolean recursive)
Compresses source files into a zip archive (default compression)
|
static File |
zip(File[] sourceFiles,
File destination,
boolean recursive,
int level)
Compresses source files into a zip archive
|
static File |
zip(File[] sourceFiles,
File destination,
int level)
Compresses source files into a zip archive (no recursive)
|
static File |
zip(File[] sourceFiles,
String destination)
Compresses source files into a zip archive (no recursive, default compression)
|
static File |
zip(File[] sourceFiles,
String destination,
boolean recursive)
Compresses source files into a zip archive (default compression)
|
static File |
zip(File[] sourceFiles,
String destination,
boolean recursive,
int level)
Compresses source files into a zip archive
|
static File |
zip(File[] sourceFiles,
String destination,
int level)
Compresses source files into a zip archive (no recursive)
|
static File |
zip(String[] sourceFiles,
File destination)
Compresses source files into a zip archive (no recursive, default compression)
|
static File |
zip(String[] sourceFiles,
File destination,
boolean recursive)
Compresses source files into a zip archive (default compression)
|
static File |
zip(String[] sourceFiles,
File destination,
boolean recursive,
int level)
Compresses source files into a zip archive
|
static File |
zip(String[] sourceFiles,
File destination,
int level)
Compresses source files into a zip archive (no recursive)
|
static File |
zip(String[] sourceFiles,
String destination)
Compresses source files into a zip archive (no recursive, default compression)
|
static File |
zip(String[] sourceFiles,
String destination,
boolean recursive)
Compresses source files into a zip archive (default compression)
|
static File |
zip(String[] sourceFiles,
String destination,
boolean recursive,
int level)
Compresses source files into a zip archive
|
static File |
zip(String[] sourceFiles,
String destination,
int level)
Compresses source files into a zip archive (no recursive)
|
public static final int BEST_SPEED
public static final int BEST_COMPRESSION
public static final int DEFAULT_COMPRESSION
public static final int NO_COMPRESSION
public static File zip(File[] sourceFiles, File destination, boolean recursive, int level) throws IOException
sourceFiles - A File array with the files to include in the root of the archivedestination - A File descriptor to the location where the zip file should be createdrecursive - Indicate whether or not recursively zipping nested directorieslevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static void unzip(File zipFile, File destination) throws IOException
zipFile - A String with the path to the source zip archivedestination - A String with the location where the zip archive will be extracted. If this destination directory
does not exist, it will be created.IOException - if the zip file cannot be read, the destination directory cannot be created or the extraction is not
successfulpublic static File zip(String[] sourceFiles, String destination) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip fileFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(String[] sourceFiles, String destination, int level) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip filelevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(String[] sourceFiles, String destination, boolean recursive) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip filerecursive - A boolean indicating whether or not recursively zipping nested directoriesFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(String[] sourceFiles, String destination, boolean recursive, int level) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip filerecursive - Indicate whether or not recursively zipping nested directorieslevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(String[] sourceFiles, File destination) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A File with the path name of the resulting zip fileFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(String[] sourceFiles, File destination, int level) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A File with the path name of the resulting zip filelevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(String[] sourceFiles, File destination, boolean recursive) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A File with the path name of the resulting zip filerecursive - Indicate whether or not recursively zipping nested directoriesFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(String[] sourceFiles, File destination, boolean recursive, int level) throws IOException
sourceFiles - A String array with the file names to be included in the root of the archivedestination - A File with the path name of the resulting zip filerecursive - Indicate whether or not recursively zipping nested directorieslevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(File[] sourceFiles, String destination) throws IOException
sourceFiles - A File array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip fileFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(File[] sourceFiles, String destination, int level) throws IOException
sourceFiles - A File array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip filelevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(File[] sourceFiles, String destination, boolean recursive) throws IOException
sourceFiles - A File array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip filerecursive - Indicate whether or not recursively zipping nested directoriesFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(File[] sourceFiles, String destination, boolean recursive, int level) throws IOException
sourceFiles - A File array with the file names to be included in the root of the archivedestination - A String with the path name of the resulting zip filerecursive - Indicate whether or not recursively zipping nested directorieslevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(File[] sourceFiles, File destination) throws IOException
sourceFiles - A File array with the file names to be included in the root of the archivedestination - A File with the path name of the resulting zip fileFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(File[] sourceFiles, File destination, boolean recursive) throws IOException
sourceFiles - A File array with the file names to be included in the root of the archivedestination - A File with the path name of the resulting zip filerecursive - Indicate whether or not recursively zipping nested directoriesFile descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static File zip(File[] sourceFiles, File destination, int level) throws IOException
sourceFiles - A File array with the file names to be included in the root of the archivedestination - A File with the path name of the resulting zip filelevel - The zip algorithm compression level. Ranges between 0 (no compression) and 9 (max. compression)File descriptor of the zip archive fileIOException - If the zip file can not be created, or the input files names can not be correctly parsedpublic static void unzip(String zipFile, String destination) throws IOException
zipFile - A String with the path to the source zip archivedestination - A String with the location where the zip archive will be extracted. If this destination directory
does not exist, it will be created.IOException - if the zip file cannot be read, the destination directory cannot be created or the extraction is not
successfulpublic static void unzip(File zipFile, String destination) throws IOException
zipFile - A File with the path to the source zip archivedestination - A String with the location where the zip archive will be extracted.IOException - if the zip file cannot be read, the destination directory cannot be created or the extraction is not
successfulpublic static void unzip(String zipFile, File destination) throws IOException
zipFile - A String with the path to the source zip archivedestination - A File with the location where the zip archive will be extracted.IOException - if the zip file cannot be read, the destination directory cannot be created or the extraction is not
successfulCopyright © 2009–2021 Opencast Project. All rights reserved.