List of utility methods to do Zip File
void | zip(File path) zip zip(path.getAbsolutePath(), path.getAbsolutePath()); |
void | zip(File source, File target) zip final ZipOutputStream out = new ZipOutputStream(new FileOutputStream(target)); zip("", source, out); out.close(); |
void | zip(File source, File target) zip zip(source, target, false); |
void | zip(File sourceDir, OutputStream targetStream) zip if (!sourceDir.isFile() && !sourceDir.isDirectory()) { return; final ZipOutputStream cpZipOutputStream = new ZipOutputStream(targetStream); cpZipOutputStream.setLevel(9); zipFiles(sourceDir, sourceDir, cpZipOutputStream); cpZipOutputStream.finish(); cpZipOutputStream.close(); ... |
void | zip(File src, File target) zip a folder to a file zip(src, null, target, ALL_FILES); |
void | zip(File srcDir, File zipFile) Create a zip from the specified directory. mkdir(parent(zipFile)); ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(zipFile))); try { File[] kids = list(srcDir); for (int i = 0; kids != null && i < kids.length; ++i) zip(kids[i], "", out); } finally { out.close(); ... |
void | zip(File srcDirectory, File destFile) Zips a directory zip(srcDirectory, destFile, false); |
void | zip(File srcFile, File destFile, String archiveRoot) Zip a file or a directory. FileOutputStream fout = new FileOutputStream(destFile); try { zip(srcFile, fout, archiveRoot); } finally { fout.close(); |
void | zip(File theFileToZip) zip byte[] buf = new byte[8096]; File zipFile = new File(theFileToZip.getParent(), theFileToZip.getName() + ".zip"); try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))) { try (FileInputStream fis = new FileInputStream(theFileToZip)) { zos.putNextEntry(new ZipEntry(theFileToZip.getName())); int lenght; while ((lenght = fis.read(buf)) > 0) { zos.write(buf, 0, lenght); ... |
void | zip(File toZip, File outFile) Zips the specified file or folder ZipOutputStream out = null; try { out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(outFile))); byte[] data = new byte[BUF_SIZE]; ArrayList<File> listToZip = new ArrayList<File>(); listToZip.add(toZip); while (listToZip.size() > 0) { File file = listToZip.remove(0); ... |