Java Utililty Methods Zip Folder

List of utility methods to do Zip Folder

Description

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

Method

voidzipDir(File zipFile, File dirObj)
zip Dir
if (!dirObj.isDirectory()) {
    System.err.println(dirObj.getName() + " is not a directory");
    System.exit(1);
try {
    ZipOutputStream out = new ZipOutputStream(new FileOutputStream(zipFile));
    System.out.println("Creating : " + zipFile);
    addDir(dirObj, out);
...
voidzipDir(final String dir2zip, final ZipOutputStream zos, final String root)
Create a structured zip archive recursively.
final File zipDir = new File(dir2zip);
final byte[] readBuffer = new byte[BUFFER_SIZE];
int bytesIn = 0;
for (final String pathName : zipDir.list()) {
    final File file = new File(zipDir, pathName);
    final String path = file.getPath();
    if (file.isDirectory()) {
        zipDir(path, zos, root);
...
voidzipDir(String baseDir, String dir2zip, ZipOutputStream zos)
Zip a directory to a zip output stream
File zipDir = new File(dir2zip);
String[] dirList = zipDir.list();
byte[] readBuffer = new byte[2156];
int bytesIn = 0;
for (int i = 0; i < dirList.length; i++) {
    File f = new File(zipDir, dirList[i]);
    if (f.isDirectory()) {
        String filePath = f.getPath();
...
voidzipDir(String dir, ZipOutputStream zos)
zip Dir
File zipDir = new File(dir);
String[] dirList = zipDir.list();
byte[] readBuffer = new byte[1024];
int bytesIn;
for (int i = 0; i < dirList.length; i++) {
    File f = new File(zipDir, dirList[i]);
    if (f.isFile()) {
        FileInputStream fis = new FileInputStream(f);
...
voidzipDir(String dir2zip, FilenameFilter filter, java.util.zip.ZipOutputStream zos, int bufferSize)
Zip a directory and writes it on parameter ZipOutStream.
File zipDir = new File(dir2zip);
zipDir(zipDir, zipDir, filter, zos, bufferSize);
voidzipDir(String dir2zip, String zipFileName)
Recursively zips a directory
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipFileName));
try {
    _zipDir(dir2zip, zos);
} finally {
    zos.close();
voidzipDir(String dir2zip, ZipOutputStream zipOut, String zipFileName)
zips a directory
File zipDir = new File(dir2zip);
String[] dirList = zipDir.list();
byte[] readBuffer = new byte[2156];
int bytesIn = 0;
for (int i = 0; i < dirList.length; i++) {
    File f = new File(zipDir, dirList[i]);
    if (f.isDirectory()) {
        String filePath = f.getPath();
...
voidzipDir(String dir2zip, ZipOutputStream zos)
zip Dir
try {
    File zipDir = new File(dir2zip);
    String[] dirList = zipDir.list();
    byte[] readBuffer = new byte[2156];
    int bytesIn = 0;
    for (int i = 0; i < dirList.length; i++) {
        File f = new File(zipDir, dirList[i]);
        if (f.isDirectory()) {
...
voidzipDir(String directory, String zipName)
Zip up a directory
if (!zipName.endsWith(".zip")) {
    zipName += ".zip";
ZipOutputStream zos = new ZipOutputStream(new FileOutputStream(zipName));
zipDir(directory, zos, "");
closeQuietly(zos);
voidzipDir(String origDir, File dirObj, ZipOutputStream zos)
zip Dir
File[] files = dirObj.listFiles();
byte[] tmpBuf = new byte[1024];
for (int i = 0; i < files.length; i++) {
    if (files[i].isDirectory()) {
        zipDir(origDir, files[i], zos);
        continue;
    String wAbsolutePath = files[i].getAbsolutePath().substring(origDir.length() + 1,
...