List of utility methods to do Zip Folder
void | zipFolder(String srcFolder, String destZipFile) zip Folder ZipOutputStream zip = null; FileOutputStream fileWriter = null; fileWriter = new FileOutputStream(destZipFile); zip = new ZipOutputStream(fileWriter); addFolderToZip("", srcFolder, zip); zip.flush(); zip.close(); |
void | zipFolder(String srcFolder, String destZipFile) zip Folder ZipOutputStream zip = null; FileOutputStream fileWriter = null; fileWriter = new FileOutputStream(destZipFile); zip = new ZipOutputStream(fileWriter); File f = new File(srcFolder); File[] subFiles = f.listFiles(); for (int i = 0; i < subFiles.length; i++) { File subFile = subFiles[i]; ... |
void | zipFolder(String srcFolder, String destZipFile) zip Folder ZipOutputStream zip = null; FileOutputStream fileWriter = null; try { fileWriter = new FileOutputStream(destZipFile); zip = new ZipOutputStream(fileWriter); } catch (Exception ex) { ex.printStackTrace(); return; ... |
void | zipFolder(String srcFolder, String destZipFile, boolean addBaseFolder) Compress a folder and its contents. if (new File(srcFolder).isDirectory()) { ZipOutputStream zip = null; FileOutputStream fileWriter = null; try { fileWriter = new FileOutputStream(destZipFile); zip = new ZipOutputStream(fileWriter); addFolderToZip("", srcFolder, zip, addBaseFolder); } finally { ... |
void | zipFolder(String srcFolderPath, String outputZipPath) Zip folder ZipOutputStream zip = null; FileOutputStream fileWriter = null; fileWriter = new FileOutputStream(outputZipPath); zip = new ZipOutputStream(fileWriter); addFolderToZip("", srcFolderPath, zip); zip.flush(); zip.close(); |
void | zipFolder(ZipOutputStream zipOut, File folder, File root) zip Folder byte[] data = new byte[BUFFER_SIZE]; String prefix = root.getAbsolutePath(); for (File f : folder.listFiles()) { if (f.isDirectory()) { zipFolder(zipOut, f, root); } else { zipOut.putNextEntry(new ZipEntry(f.getAbsolutePath().substring(prefix.length()))); FileInputStream in = new FileInputStream(f); ... |
void | zipFolder2(ZipOutputStream zos, String folderName, String baseFolderName) zip Folder File f = new File(folderName); if (f.exists()) { if (f.isDirectory()) { if (!folderName.equalsIgnoreCase(baseFolderName)) { String entryName = folderName.substring(baseFolderName.length(), folderName.length()) + File.separatorChar; ZipEntry ze = new ZipEntry(entryName); zos.putNextEntry(ze); ... |