How do I unzip a zip file with multiple txt file and turn it into a new txt file with out overwritten the information in the file in java
<p>Here is what i have but the file keep overwritten the previous information. is there a way to just upzip the file and write the file to a text file with out physical putting the file in a folder. </p>

<pre><code>import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.List;
import java.util.Vector;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.*; 

public class cuscreport 
{
    List&lt;String&gt; fileList;
    private static final String INPUT_ZIP_FILE = "c:\\cusc031513.zip";
    private static final String OUTPUT_FOLDER = "C:\\temp\\test";
    Vector&lt;String&gt; v =new Vector&lt;String&gt;();

    public static void main( String[] args ) throws IOException
    {
        cuscreport unZip = new cuscreport();
        unZip.unZipIt(INPUT_ZIP_FILE,OUTPUT_FOLDER);
    }
    private  final static String getDate(  )   {  
        DateFormat df = new SimpleDateFormat( "yyyy-MM-dd" ) ;  
        df.setTimeZone( TimeZone.getTimeZone( "EST" )  ) ;  
        return ( df.format( new Date(  )  )  ) ;  
    }  

    /**
     * Unzip it
     * @param zipFile input zip file
     * @param output zip file output folder
     */
    public void unZipIt(String zipFile, String outputFolder) throws IOException
    {

        byte[] buffer = new byte[1024];

     try{

        //create output directory is not exists
        File folder = new File(OUTPUT_FOLDER);
        if(!folder.exists())
        {
            folder.mkdir();
        }

        //get the zip file content
        ZipInputStream zis = 
            new ZipInputStream(new FileInputStream(zipFile));
        //get the zipped file list entry
        ZipEntry ze= zis.getNextEntry();




        while(ze!=null){

           String fileName = ze.getName();
           File newFile = new File(outputFolder + File.separator + fileName);

           System.out.println("file unzip : "+ newFile.getAbsoluteFile());
           v.add(fileName);

            //create all non exists folders
            //else you will hit FileNotFoundException for compressed folder
            new File(newFile.getParent()).mkdirs();

           FileOutputStream fos = new FileOutputStream(newFile);             

            int len;
            while ((len = zis.read(buffer)) &gt; 0) {
            fos.write(buffer, 0, len);
            }

            fos.close(); 
            ze = zis.getNextEntry();
        }

        zis.closeEntry();
        zis.close();

        for(int x = 1; x &lt; v.size()-1; x++ )
        {
             System.out.println(v.get(x));
             File inputFile = new File( outputFolder + File.separator +v.get(x));
             FileReader in = new FileReader(inputFile);
             File outputFile = new File("C:\\temp\\test\\cuscreport"+getDate()+".txt");
             int c;
             FileWriter out = new FileWriter(outputFile);
             while ((c = in.read()) != -1)
             {
                    out.write(c);
             }

                 in.close();
                 out.close();
        }



        System.out.println("Done");

    }catch(IOException ex){
       ex.printStackTrace(); 
    }
   }    
}
</code></pre>

<p>Here is what i have but the file keep overwritten the previous information. is there a way to just upzip the file and write the file to a text file with out physical putting the file in a folder. </p>
