Java Utililty Methods Zip Directory

List of utility methods to do Zip Directory

Description

The list of methods to do Zip Directory are organized into topic(s).

Method

voidzipDirectoryEntry(ZipOutputStream output, IPath entry, long time, Set directoryEntries)
zip Directory Entry
entry = entry.addTrailingSeparator();
if (!directoryEntries.contains(entry)) {
    if (entry.segmentCount() > 1)
        zipDirectoryEntry(output, entry.removeLastSegments(1), time, directoryEntries);
    try {
        ZipEntry dirEntry = new ZipEntry(entry.toString());
        dirEntry.setTime(time);
        output.putNextEntry(dirEntry);
...
voidzipDirectoryRecursive(File directory, String zipPath, ZipOutputStream zos, ArrayList avoidingFiles)
zip Directory Recursive
try {
    System.out.println(directory.getAbsolutePath() + "::" + zipPath);
    String[] dirList = directory.list();
    byte[] readBuffer = new byte[2156];
    int bytesIn = 0;
    for (int i = 0; i < dirList.length; i++) {
        File f = new File(directory, dirList[i]);
        System.err.println("avoiding: " + avoidingFiles);
...
voidzipSubDirectory(String basePath, File dir, ZipOutputStream zout)
zip Sub Directory
byte[] buffer = new byte[4096];
File[] files = dir.listFiles();
for (File file : files) {
    if (file.isDirectory()) {
        String path = basePath + file.getName() + "/";
        zout.putNextEntry(new ZipEntry(path));
        zipSubDirectory(path, file, zout);
        zout.closeEntry();
...