List of utility methods to do Zip Directory
void | zip(File directory, File base, ZipOutputStream zos) zip File[] files = directory.listFiles(); byte[] buffer = new byte[8192]; int read = 0; for (int i = 0, n = files.length; i < n; i++) { if (files[i].isDirectory()) { zip(files[i], base, zos); } else { FileInputStream in = new FileInputStream(files[i]); ... |
void | zip(File directory, File base, ZipOutputStream zos, byte[] buffer) zip int read = 0; for (File file : directory.listFiles()) { if (file.isDirectory()) { zip(file, base, zos, buffer); } else { FileInputStream in = new FileInputStream(file); try { ZipEntry entry = new ZipEntry(file.getPath().substring(base.getPath().length() + 1)); ... |
void | zip(File directory, File file) Recursively packs a directory into a zip file. ZipOutputStream out = new ZipOutputStream(new FileOutputStream(file)); try { zip(directory, directory.getPath().length() + 1, out); } finally { out.close(); |
void | zip(File directory, File zipFile) Zip the contents of a directory ZipOutputStream zipStream = null; try { zipStream = new ZipOutputStream(new FileOutputStream(zipFile)); zipDir(directory.getPath(), directory.getPath(), zipStream); } catch (IOException ioe) { throw ioe; } finally { try { ... |
void | zip(File directory, File zipFile) Zip. try { FileOutputStream os = new FileOutputStream(zipFile); ZipOutputStream zos = new ZipOutputStream(os); zipDirectory(directory, directory, zos); zos.close(); os.close(); } catch (Exception e) { throw new RuntimeException(e); ... |
void | zipDirectories(List zip Directories zipDirectories(directories, baseDirectory, new FileOutputStream(zipFile), null);
|
void | zipDirectory(File baseDirectory, File output) Create a ZIP archive of a directory. try { FileOutputStream fos = new FileOutputStream(output); ZipOutputStream zos = new ZipOutputStream(fos); Deque<File> directories = new ArrayDeque<File>(); if (baseDirectory.isDirectory()) { directories.add(baseDirectory); while (!directories.isEmpty()) { File directory = directories.poll(); ... |
File | zipDirectory(File dir, boolean includeDirInZip, boolean includeHidden) create a zip file of the contents of the folder, optionally including the folder itself. return zipDirectory(dir, includeDirInZip, includeHidden, null);
|
boolean | zipDirectory(File dir, File zipFile) Zip a directory and its subdirectories, preserving the name of the root directory (dir) in all paths in the zip file. return zipDirectory(dir, zipFile, false);
|
void | zipDirectory(File dir, String base, ZipOutputStream zout) zip Directory File[] files = dir.listFiles(); base += dir.getName() + "/"; if (files.length > 0) { for (File file : files) { if (file.isDirectory()) { zipDirectory(file, base, zout); } else { zipOneFile(file, base, zout); ... |