递归压缩文件zip

public class ZipRecuSionUtils {
   

    private static final int BUFFER_SIZE = 2 * 1024;

    /**
     * 递归压缩
     *
     * @param sourceFile
     * @param zos
     * @param name
     * @param KeepDirStructure
     * @throws Exception
     */
    public void compress(File sourceFile, ZipOutputStream zos, String name,
   								  boolean KeepDirStructure) throws Exception {
   
        byte[] buf = new byte[BUFFER_SIZE];
        if (sourceFile.isFile()) {
   
            zos.putNextEntry(new ZipEntry(name));
          

你可能感兴趣的:(代码)