package ru.matevosyan;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.Enumeration;
import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import java.util.zip.ZipInputStream;

/**
 * Created for zipping file from archive.
 * Created on 19.02.2017.
 * @author Matevosyan Vardan
 * @version 1.0
 */

public class zipWithStructure {

    public void zipping(File file, String[] keys) throws IOException {

        try (ZipInputStream zip = new ZipInputStream(new FileInputStream(file)); ZipFile zipFile = new ZipFile(file)) {
            ZipEntry entry;
            Enumeration entries = zipFile.entries();
            while (entries.hasMoreElements()) {
                entry = (ZipEntry) entries.nextElement();
                for (String key : keys) {
                    if (entry.getName().contains("." + key)) {

                    }
                }
            }
        }  catch (FileNotFoundException fnfe) {
            fnfe.getMessage();
        }
    }
}

@@ -36,110 +36,9 @@
 .io.
-File;%0Aimport java.io.FileInputStream;%0Aimport java.io.FileNotFoundException;%0Aimport java.io.IOException
+*
 ;%0Aim
@@ -364,10 +364,12 @@
 ring
-%5B%5D
+ ...
  key
@@ -473,16 +473,29 @@
 (file));
+%0A            
  ZipFile
@@ -822,139 +822,749 @@
 ) %7B%0A
-%0A                    %7D%0A                %7D%0A            %7D%0A        %7D  catch (FileNotFoundException fnfe) %7B%0A            fnfe.getMessage(
+                        writeToZip(zipFile.getInputStream(entry),%0A                                new BufferedOutputStream(new FileOutputStream(%0A                                        new File(file.getParent(), entry.getName()))));%0A                    %7D else if (entry.isDirectory()) %7B%0A                        new File(file.getParent(), entry.getName()).mkdirs();%0A                    %7D%0A                %7D%0A            %7D%0A        %7D  catch (FileNotFoundException fnfe) %7B%0A            fnfe.getMessage();%0A        %7D%0A    %7D%0A%0A    public void writeToZip(InputStream in, OutputStream out) throws IOException %7B%0A        byte%5B%5D buff = new byte%5B1024%5D;%0A        int length;%0A        while ((length = in.read(buff)) != -1) %7B%0A            out.write(buff, 0, length
 );%0A 

add writeToZip method