List of utility methods to do Zip File
void | zip(File destination, File... files) Zips a set of files in one file. BufferedInputStream origin = null; FileOutputStream dest = new FileOutputStream(destination); try (ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest))) { byte data[] = new byte[BUFFER]; for (int i = 0; i < files.length; i++) { FileInputStream fi = new FileInputStream(files[i]); origin = new BufferedInputStream(fi, BUFFER); ZipEntry entry = new ZipEntry(files[i].getName()); ... |
File | zip(File f, File destfile) zip java.io.BufferedOutputStream out = null; ZipOutputStream zipOut = null; try { out = new BufferedOutputStream(new FileOutputStream(destfile)); zipOut = new ZipOutputStream(out); String basePath; if (f.isDirectory()) basePath = f.getPath(); ... |
void | zip(File f, File out) Creates ZIP of the file. try (FileOutputStream fos = new FileOutputStream(out); BufferedOutputStream bos = new BufferedOutputStream(fos); ZipOutputStream zos = new ZipOutputStream(bos)) { addToZip(f, f.getAbsolutePath().length(), zos, new byte[4096]); |
void | zip(File file, File output) zip FileOutputStream outputStream = new FileOutputStream(output); ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream); String rootDirectory; if (file.isDirectory()) { rootDirectory = file.getPath(); } else { rootDirectory = file.getParentFile().getPath(); zip(file, rootDirectory, zipOutputStream); zipOutputStream.close(); |
void | zip(File file, File zip) zip ZipOutputStream zos = null; try { String name = file.getName(); zos = new ZipOutputStream(new FileOutputStream(zip)); ZipEntry entry = new ZipEntry(name); zos.putNextEntry(entry); FileInputStream fis = null; try { ... |
File | zip(File file, String dest) zip File zippedFile = new File(dest + "/" + file.getName() + ".zip"); try { FileOutputStream ops = new FileOutputStream(zippedFile); ZipOutputStream zos = new ZipOutputStream(ops); zip(file, zos, ""); zos.close(); } catch (FileNotFoundException fnfex) { fnfex.printStackTrace(); ... |
void | zip(File fromFile, File toFile) Zip the sourceFile into toFile. zip(new FileInputStream(fromFile), toFile);
|
void | zip(File input, File output) zip byte[] block = new byte[16384]; FileInputStream fis = null; FileOutputStream fos = null; ZipOutputStream zos = null; try { fis = new FileInputStream(input); fos = new FileOutputStream(output); zos = new ZipOutputStream(fos); ... |
void | zip(File input, File outputZip) zip zip(input, new FileOutputStream(outputZip), false, null);
|
void | zip(File inputDirectory, File zippedFile, FileFilter filter) zip int BUFFER = 2048; try { BufferedInputStream origin = null; FileOutputStream dest = new FileOutputStream(zippedFile); ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(dest)); byte data[] = new byte[BUFFER]; File files[]; if (filter != null) { ... |