List of utility methods to do Zip File List
void | zip(Collection files, File zipFile) zip FileOutputStream fos = new FileOutputStream(zipFile); try { BufferedOutputStream bos = new BufferedOutputStream(fos); try { ZipOutputStream zos = new ZipOutputStream(bos); try { for (Iterator i = files.iterator(); i.hasNext();) { File file = (File) i.next(); ... |
void | zip(File zipFile, File parentDir, File[] sources, char pathSeparator) Recursively zips a set of root entries into a zipfile, compressing the contents. String stripPath = (parentDir != null) ? parentDir.getPath() : ""; if (stripPath.length() > 0 && !stripPath.endsWith(File.separator)) { stripPath += File.separator; ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile)); out.setMethod(ZipOutputStream.DEFLATED); try { for (File source : sources) { ... |
void | zip(File zipFile, File[] files) zip try { BufferedInputStream origin = null; FileOutputStream dest = new FileOutputStream(zipFile); ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest)); out.setMethod(ZipOutputStream.DEFLATED); byte data[] = new byte[BUFFER]; for (int i = 0; i < files.length; i++) { FileInputStream fi = new FileInputStream(files[i]); ... |
void | zip(File zipFile, File[] files) zip byte[] buffer = new byte[1024]; try (ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile))) { for (File file : files) { ZipEntry ze = new ZipEntry(file.getName()); zos.putNextEntry(ze); try (FileInputStream in = new FileInputStream(file)) { int len; while ((len = in.read(buffer)) > 0) { ... |
File | zip(File zipFile, List zip ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile)); zip(out, files); return zipFile; |
void | zip(Iterable Zips the specified files, including directories and nested directories into the specified zip file. ZipOutputStream zip = new ZipOutputStream(new FileOutputStream(toZipFile)); if (files != null) { for (File file : files) { if (file.exists()) { if (file.isDirectory()) { addFolderToZip(file, baseFolderName, zip); } else { addFileToZip(file, baseFolderName, zip); ... |
void | zip(List zip ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFile)); for (File file : runtimeLibFiles) { zip(file, "app" + fileSeparator + "lib", zos); zos.close(); |
byte[] | zip(List Zip files ByteArrayOutputStream baos = new ByteArrayOutputStream(); ZipOutputStream out = new ZipOutputStream(baos); for (int i = 0, size = fileNames.size(); i < size; i++) { String name = fileNames.get(i); byte[] content = fileContents.get(i); ZipEntry entry = new ZipEntry(name); entry.setSize(content.length); out.putNextEntry(entry); ... |
void | zip(List zip byte[] buf = new byte[1024]; try { ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFileName)); for (String fileName : fileNames) { FileInputStream in = new FileInputStream(fileName); out.putNextEntry(new ZipEntry(fileName)); int len; while ((len = in.read(buf)) > 0) { ... |
ZipOutputStream | zip(List zip byte[] buffer = new byte[1024]; ZipOutputStream zos = new ZipOutputStream(os); for (String f : srcFiles) { File srcFile = new File(f); FileInputStream fis = new FileInputStream(srcFile); zos.putNextEntry(new ZipEntry(srcFile.getName())); int length; while ((length = fis.read(buffer)) > 0) { ... |