Here you can find the source of addFolderToZip(String folderPath, ZipOutputStream out)
Parameter | Description |
---|---|
folderPath | the path to the folder relative to the zip file (e.g. "data", note that there is no tailing "/") |
out | the zip stream |
Parameter | Description |
---|---|
IOException | if an IOException occurs |
public static void addFolderToZip(String folderPath, ZipOutputStream out) throws IOException
//package com.java2s; //License from project: Apache License import java.io.IOException; import java.util.zip.ZipEntry; import java.util.zip.ZipOutputStream; public class Main { /**//from ww w .jav a 2s . c om * Adds a new entry to the zip file corresponding to a new folder. * * @param folderPath the path to the folder relative to the zip file (e.g. * "data", note that there is no tailing "/") * @param out the zip stream * * @throws IOException if an IOException occurs */ public static void addFolderToZip(String folderPath, ZipOutputStream out) throws IOException { out.putNextEntry(new ZipEntry(folderPath + "/")); } }