// Path: src/main/java/br/com/tecsinapse/dataio/util/ZipUtil.java
// @UtilityClass
// public final class ZipUtil {
// 
//     public static void zip(File newZip, File... filesToAdd) throws IOException {
//         try (ZipOutputStream zos = new ZipOutputStream(
//                 new BufferedOutputStream(new FileOutputStream(newZip)))) {
//             for (File file : filesToAdd) {
//                 addFile(zos, file);
//             }
//         }
//     }
// 
//     public static void addFile(ZipOutputStream zos, File file) throws IOException {
//         if (file.isDirectory()) {
//             ZipEntry entry = new ZipEntry(file.getName());
//             zos.putNextEntry(entry);
//             for (File subFile : file.listFiles()) {
//                 addFile(zos, subFile);
//             }
//             zos.closeEntry();
//         }
// 
//         try (FileInputStream fis = new FileInputStream(file)) {
//             ZipEntry entry = new ZipEntry(file.getName());
//             zos.putNextEntry(entry);
//             ByteStreams.copy(fis, zos);
//             zos.closeEntry();
//         }
//     }
// 
// }


import java.io.File;
import org.testng.annotations.Test;
import br.com.tecsinapse.dataio.util.ZipUtil;
/*
 * Tecsinapse Data Input and Output
 *
 * License: GNU Lesser General Public License (LGPL), version 3 or later
 * See the LICENSE file in the root directory or <http://www.gnu.org/licenses/lgpl-3.0.html>.
 */
package br.com.tecsinapse.dataio;




public class ZipUtilTest {

    @Test
    public void testZip() throws Exception {
        File[] files = new File[]{
                ResourceUtils.getFileResource("/files/excel.xls"),
                ResourceUtils.getFileResource("/files/excel.xlsx")
        };

        File outZip1 = ResourceUtils.newFileTargetResource("zipOut-1.zip");
// Path: src/main/java/br/com/tecsinapse/dataio/util/ZipUtil.java
// @UtilityClass
// public final class ZipUtil {
// 
//     public static void zip(File newZip, File... filesToAdd) throws IOException {
//         try (ZipOutputStream zos = new ZipOutputStream(
//                 new BufferedOutputStream(new FileOutputStream(newZip)))) {
//             for (File file : filesToAdd) {
//                 addFile(zos, file);
//             }
//         }
//     }
// 
//     public static void addFile(ZipOutputStream zos, File file) throws IOException {
//         if (file.isDirectory()) {
//             ZipEntry entry = new ZipEntry(file.getName());
//             zos.putNextEntry(entry);
//             for (File subFile : file.listFiles()) {
//                 addFile(zos, subFile);
//             }
//             zos.closeEntry();
//         }
// 
//         try (FileInputStream fis = new FileInputStream(file)) {
//             ZipEntry entry = new ZipEntry(file.getName());
//             zos.putNextEntry(entry);
//             ByteStreams.copy(fis, zos);
//             zos.closeEntry();
//         }
//     }
// 
// }


// Path: src/test/java/br/com/tecsinapse/dataio/ZipUtilTest.java
import java.io.File;
import org.testng.annotations.Test;
import br.com.tecsinapse.dataio.util.ZipUtil;

/*
 * Tecsinapse Data Input and Output
 *
 * License: GNU Lesser General Public License (LGPL), version 3 or later
 * See the LICENSE file in the root directory or <http://www.gnu.org/licenses/lgpl-3.0.html>.
 */
package br.com.tecsinapse.dataio;




public class ZipUtilTest {

    @Test
    public void testZip() throws Exception {
        File[] files = new File[]{
                ResourceUtils.getFileResource("/files/excel.xls"),
                ResourceUtils.getFileResource("/files/excel.xlsx")
        };

        File outZip1 = ResourceUtils.newFileTargetResource("zipOut-1.zip");
        ZipUtil.zip(outZip1, files);