ZipInputStream & ZipEntry taking time to unzip big file

Hi,
We have big zip file around 2GB which needs to downloaded and unzipped. We are using ZipInputStream & ZipEntry for unzipping the files.
This is taking around 45 min to unzip the file. Do we have better alternative for doing the same?
Thanks in advance
Regards,
Ravi

Below is the code we are using:
public void getZipFiles(String sSourcePath, String sDestPath)
        try
            sDestPath = sDestPath + Util.getFileSeparator();
            byte[] buf = new byte[1024];
            ZipInputStream zipinputstream = null;
            ZipEntry zipentry;
            BufferedOutputStream  outBuffer =null;
            BufferedInputStream inBuffer = null;
            zipinputstream = new ZipInputStream(
                new FileInputStream(sSourcePath));
            String sFile =sSourcePath.substring(0,  sSourcePath.indexOf("."));
        File f = new File(sFile);
        if(f.mkdir())
            System.out.println( f + " Directory Created");
        else
        System.out.println(f + " Directory is not created");
            zipentry = zipinputstream.getNextEntry();
            while (zipentry != null)
                //for each entry to be extracted
                String entryName = zipentry.getName();
                int n;
                if(zipentry.isDirectory())
                    File f1 = new File(sDestPath+zipentry.getName());
                     if(f1.mkdir())
                            System.out.println(f + " Directory Created");
                        else
                        System.out.println(f + " Directory is not created");
                else
                FileOutputStream fileoutputstream;
                File newFile = new File(entryName);
                String directory = newFile.getParent();
                if(directory == null)
                    if(newFile.isDirectory())
                        break;
                fileoutputstream = new FileOutputStream(sDestPath+entryName);
                outBuffer = new BufferedOutputStream(fileoutputstream);
                inBuffer = new BufferedInputStream(zipinputstream);
               /* while ((n = zipinputstream.read(buf, 0, 1024)) > -1)
                    fileoutputstream.write(buf, 0, n);*/
                while(true){
                   int bytedata = inBuffer.read();
                  if(bytedata == -1)       break;
                  outBuffer.write(bytedata);
                outBuffer.flush();
                fileoutputstream.close();
                fileoutputstream.flush();
               // zipinputstream.closeEntry();
                zipentry = zipinputstream.getNextEntry();
            }//while
            zipinputstream.close();
            outBuffer.close();
            inBuffer.close();
        catch (Exception e)
            e.printStackTrace();
    }Edited by: EJP on 5/02/2013 22:07: code tags

Similar Messages

  • Quicktimes taking very long time to load-Big Q appears instead.

    When posting ipod (small) quicktimes to my .mac account (4 per page), the site is taking a really long time to load-a large Q appears instead of the usual Quicktime video frame for a few minutes. They eventually load, but it takes a long time. I've used this program and these files for a year without incident, and now there is this huge delay for my clients. The files aren't very big 2MB-20MB.
    Maybe it's my Safari or Firefox acting up?
    Here's the site if anyone is able to have a quick look and tell me if it loads quickly on their machine:
    http://web.mac.com/chopperfilms/iWeb/Steve%20Gaskin/Projects%201.html
    Any thoughts would be greatly appreciated. Thanks so much.

    To wait for 27MB to load is too big or rather long wait for your audience/visitor. Set poster frames for all and use movie ref to load only the one the visitor chooses so they don't get the letter 'Q' and use 'fast start' so loading long or big files feels like less waiting. Were poster frames and movie refs getting done automatically by iWeb before?
    I am actually getting the letter 'Q' with a question mark in it 60/40 percent of the time in a QuickTime I posted which I am trying to figure how to get rid of.

  • Not enough space on my new SSD drive to import my data from time machine backup, how can I import my latest backup minus some big files?

    I just got a new 256GB SSD drive for my mac, I want to import my data from time machine backup, but its larger than 256GB since it used to be on my old optical drive. How can I import my latest backup keeping out some big files on the external drive?

    Hello Salemr,
    When you restore from a Time Machine back up, you can tell it to not transfer folders like Desktop, Documents. Downloads, Movies, Music, Pictures and Public. Take a look at the article below for the steps to restore from your back up.  
    Move your data to a new Mac
    http://support.apple.com/en-us/ht5872
    Regards,
    -Norm G. 

  • Adobe Photoshop CS3 collapse each time it load a big file

    I was loading a big file of photos from iMac iPhoto to Adobe Photoshop CS3 and it keep collapsing, yet each time I reopen photoshop it load the photos again and collapse again. is there a way to stop this cycle?

    I don't think that too many users here actually use iPhoto (even the Mac users)
    However, Google is your friend. A quick search came up with some other non-Adobe forum entries:
    .... but the golden rule of iPhoto is NEVER EVER MESS WITH THE IPHOTO LIBRARY FROM OUTSIDE IPHOTO.In other words, anything you might want to do with the pictures in iPhoto can be done from *within the program,* and that is the only safe way to work with it. Don't go messing around inside the "package" that is the iPhoto Library unless you are REALLY keen to lose data, because that is exactly what will happen.
    .....everything you want to do to a photo in iPhoto can be handled from *within the program.* This INCLUDES using a third-party editor, and saves a lot of time and disk space if you do this way:
    1. In iPhoto's preferences, specify a third-party editor (let's say Photoshop) to be used for editing photos.
    2. Now, when you right-click (or control-click) a photo in iPhoto, you have two options: Edit in Full Screen (ie iPhoto's own editor) or Edit with External Editor. Choose the latter.
    3. Photoshop will open, then the photo you selected will automatically open in PS. Do your editing, and when you save (not save as), PS "hands" the modified photo back to iPhoto, which treats it exactly the same as if you'd done that stuff in iPhoto's own editor and updates the thumbnail to reflect your changes. Best of all, your unmodified original remains untouched so you can always go back to it if necessary.

  • I was loading a big file of photos from iPhoto to Adobe Photoshop CS3 and it keep collapsing, yet each time I reopen photoshop it load the photos again and cal laps again. is there a way to stop this cycle?

    I was loading a big file of photos from iPhoto to Adobe Photoshop CS3 and more then midway it keep collapsing, yet each time I re-open photoshop to load a small amount of photos, it load the previous photos again, and again it collapse. is there a way to stop this cycle and start a new?

    http://helpx.adobe.com/photoshop.html

  • Taking very long time to pick the file from internal deliviery channel fold

    Hi B2B gurus,
    For one of our trading partner we are testing an AS2 connectivity, so we are sending a 850 po's through internal deliviery channel(create a folder in-house), but while placing the 850 in a internal folder, its taking very long time to pick the file form internal folder
    Could you please help me to resolve this issue?
    regards

    Hi Suni,
    Have you specified the polling interval in Transport Server configuration? By default polling interval is 60 seconds.
    What is the size of the file being picked?
    Regards,
    Anuj

  • I'd like Time Machine to backup my personal account's files separately from my guest account's files. Both have big files.  What's the best way to do this?  Should I connect 2 external HD to my new iMac, one for each account?

    I'd like Time Machine to backup my personal account's files separately from my guest account's files. Both have big files.  What's the best way to do this?  Should I connect 2 external HD to my new iMac, one for each account?

    NeuroBrain wrote:
    Since my new external hard drive is have a lot of space, I'm thinking of splitting it for Time Machine and external storage.
    This is a common mistake and I highly advise against it.
    1: TimeMachine saves states of changes and thus requires more room on the TM drive than the boot drive it's backing up.
    2: Something happens to the TM drive, loss, theft, dropped, power surge, etc., you lose both backups.
    3: The storage drive might become a portable need, with it being on the TM drive, now your increasing the risk to the TM backup that something could happen to it along with the storage drive, due to increased movement.
    Seriously, have a read,
    Most commonly used backup methods
    it's ASC User Tip that saves us regulars all the trouble of having to repeat ourselves over and over again in the posts, because we tend to forget things too, or not here sometimes etc.
    "Plan for the worst and the good will take care of itself" - Donald Trump

  • Creative Cloud error message :could not implemented unzip a file on temporarily directory (EX11)I tried many times but it was not working.

    Creative Cloud error message :
    could not implemented unzip a file on temporarily directory (EX11)
    I tried many times but it was not working.

    Nobody can tell you anything without proper system information. Failing extractions can have all sorts of causes. Start with a little system maintenance:
    Installation Preparations | Mylenium's Error Code Database
    Mylenium

  • Renaming a file to date and time after unziped

    I have a google earth kmz that is downloaded to our root directory. I am wanting to see how to rename this file after it is droped into our directory. Here is what I have so far.
    <cfif FileExists("#expandpath(".")#/temp.zip")>
    Got it .... extract....<br />
        <cfzip action="unzip" file="#expandpath(".")#/temp.zip"
        destination="#expandpath(".")#"
        overwrite="true">
        </cfzip>
    Right now the code above unzips the file and places the KMZ in the root drive. I wanted to rename the file the current  date like as follows RT_2010_03_17_12_00.kmz
    I have no idea how to accomplish this.

    The <cffile action="rename"...> is what I would look at using.
    http://livedocs.adobe.com/coldfusion/8/htmldocs/Tags_f_09.html#1098668

  • NI unzip changes file date and time stamp

    A coworker this morning asked me about the NI-Unzip VI.
    It turns out that when the NI unzip VI unzips a file it changes the file dates to the date the file was unzipped.
    He also noted that NI-Unzip seems to be calling the Windows touch.exe to do this.
    The diagram for NI unzip is locked and password protected so his attemp to change this action blocked.
    Does anyone know a way around this? Either to make the NI Unzip stop changing the file date or the passwork to teh unzip vi?
    Message Edited by RTSLVU on 03-22-2010 08:01 AM

    Hi,
    I don't think NI will give you a password for it's protected functions...
    So you can:
    - use "System Exec" with a command line version of a ZIP tool of your choice to unzip files
    - make your own "Unzip" VI with calls to a "unzip"-DLL of your choice
    Choose the one that is easier to implement for you
    Best regards,
    GerdW
    CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
    Kudos are welcome

  • Problem in unzip a file

    hai,
    Iam trying to unzip a file but its not working.
    //Unzip a file
      final int BUFFER = 2048;
      String zfname=application.getRealPath("/") + "temp/Bulk.zip"; 
           File  zf=new File(zfname);
      try {
             BufferedOutputStream dest = null;
             FileInputStream fis = new FileInputStream(zf);
             ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fis));
             ZipEntry entry;
             while((entry = zis.getNextEntry()) != null)
                                       System.out.println("Extracting: " +entry);
                     int count;
                     byte data[] = new byte[BUFFER];
                    // write the files to the disk
                    File outFile=new File(outPath);
                    //FileOutputStream fos = new FileOutputStream(outFile);
                    FileOutputStream fos = new FileOutputStream(entry.getName());
                    dest = new BufferedOutputStream(fos, BUFFER);
                    while ((count = zis.read(data, 0, BUFFER))!= -1)
                        dest.write(data, 0, count);
                    dest.flush();
                    dest.close();
             zis.close();
          } catch(Exception e) {
             e.printStackTrace();
    Bulk.zip folder has the following files:
    Bulk/test.txt
    Bulk/fm.jsp
    I get the following exception
    java.io.FileNotFoundException: Bulk\test.txt
    (The system cannot find the path specified)
    Iam i making mistake in this line
    FileOutputStream fos = new FileOutputStream(entry.getName());
                    dest = new BufferedOutputStream(fos, BUFFER);Thanks,
    Thanuja.

    ok vijay iam so sorry for not mentioning how i rectified it. somehow i missed it. may be was bit excited when i got the result.
    anyways below code worked.
    //Unzip a file
        String zip_fname=request.getParameter("zfilename")!=null?request.getParameter("zfilename"):"";
        String fromZip=zip_fname;
        //out.println("FromZip:"+fromZip);
        File zipFname=new File(newFileName);
        String toLocation=newFilePath; //path to unzip the file
        String seperator = System.getProperty("file.separator");
        System.out.println("unzipping zip file to "+toLocation);
        try
            BufferedOutputStream dest = null;
            File zipDir = new File(toLocation);
             zipDir.mkdir();
            ZipFile zip = new ZipFile(fromZip);
            final int BUFFER = 2048;
            FileInputStream fin=new FileInputStream(fromZip);
            ZipInputStream zis = new ZipInputStream(new BufferedInputStream(fin));
            ZipEntry entry;
            while((entry = zis.getNextEntry()) != null)
                     //System.out.println("Extracting: " +entry);
                     int count;
                     byte data[] = new byte[BUFFER];
                     String zip_Fname=entry.getName().substring(entry.getName().lastIndexOf("/")+1);
                        if(!zip_Fname.equals(""))
                            zipFiles.add(zip_Fname);
                  if(!zip_Fname.equals(""))  
                     FileOutputStream fos = new FileOutputStream(toLocation + seperator + entry.getName().substring(entry.getName().lastIndexOf("/")+1));
                     dest = new BufferedOutputStream(fos, BUFFER);
                     while ((count = zis.read(data, 0, BUFFER))!= -1)
                        dest.write(data, 0, count);
                    dest.flush();
                    dest.close();
             zis.close();
        catch (Exception ex)
            unZipResult++;
            System.out.println(ex);
        }Thanks,
    Thanuja.

  • Unzip a file preserving the folder structure

    Hi guys,
    I have create a zip file using java.util.zip and I preserv all directory structure. When I unzip the file using the same library, in the loop of ZipEntry I don't find never a directory. This the code that I use and don't work:
    public void dataDecompression(String pathArchivio) {
        try {
            fileInputStream = new FileInputStream(pathArchivio);
           checkedInputStream = new CheckedInputStream(fileInputStream, new Adler32());
           zipInputStream = new ZipInputStream(new BufferedInputStream(checkedInputStream));
           ZipEntry entry;
           while((entry = zipInputStream.getNextEntry()) != null){
                if(entry.isDirectory()){
                     //make dir          
               else{
                    //write file
    }Maybe I miss something in compression? Excuse for my bad english.
    Thanks in advance.

    three problems with that.
    1) you don't recusively create folders.
    2) you create a folder with the name of the file you want to write.
    3) you don't create files.
    File file=new File(entry.getName());
    if(file.getParentFile()!=null);
         file.getParentFile().mkdirs();
    if( !entry.isDirectory() ) {
    //code that write file;

  • Problen in unzip a file in folder structure

    hi,
    how can i unzip a file and folder with folder structure. when i unzip a file it create problem. please help to solve this problem.
    here is my code
    import java.io.*;
    import java.util.zip.*;
    public class MakeUnzip {
    final static int BUFFER = 2048;
    public static void main (String argv[]) {
    try {
    BufferedOutputStream dest = null;
    FileInputStream fis = new FileInputStream("D:/serverdata/dates.zip");
    // String root = "D:/clientdata/";
    ZipInputStream zis = new
    ZipInputStream(new BufferedInputStream(fis));
    ZipEntry entry;
    ZipFile zipfile = new ZipFile("D:/serverdata/dates.zip");
    while((entry = zis.getNextEntry()) != null) {
    int count;
    byte data[] = new byte[BUFFER];
    if(entry.isDirectory()){
         File dir = new File(entry.getName());
         if(!dir.exists()){          dir.mkdir();                 }      
    FileOutputStream fos =null;
    fos = new FileOutputStream(entry.getName());
    dest = new BufferedOutputStream(fos, BUFFER);
    while ((count = zis.read(data, 0, BUFFER))
    != -1) {
    dest.write(data, 0, count);
    dest.flush();
    dest.close();
    zis.close();
    } catch(Exception e) {
    e.printStackTrace();
    Please give me solution.
    Thanks in advance

    try this one and change it as u like:
    import java.util.zip.ZipFile;
    import java.util.zip.ZipEntry;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.util.Enumeration;
    import java.io.File;
    public class UnzipFile {
    private static void doUnzipFiles(String zipFileName) {
    try {
    ZipFile zf = new ZipFile(zipFileName);
    System.out.println("Archive: " + zipFileName);
    // Enumerate each entry
    for (Enumeration entries = zf.entries(); entries.hasMoreElements();) {
    // Get the entry and its name
    ZipEntry zipEntry = (ZipEntry)entries.nextElement();
    if (zipEntry.isDirectory())
    boolean success = (new File(zipEntry.getName())).mkdir();
    else
    String zipEntryName = zipEntry.getName();
    System.out.println(" inflating: " + zipEntryName);
    OutputStream out = new FileOutputStream(zipEntryName);
    InputStream in = zf.getInputStream(zipEntry);
    byte[] buf = new byte[1024];
    int len;
    while((len = in.read(buf)) > 0) {
    out.write(buf, 0, len);
    // Close streams
    out.close();
    in.close();
    } catch (IOException e) {
    e.printStackTrace();
    System.exit(1);
    public static void main(String[] args) {
    if (args.length != 1) {
    System.err.println("Usage: java UnzipFile zipfilename");
    } else {
    doUnzipFiles(args[0]);
    }

  • Upload of very big files (300MB+)

    Hello all,
    I am trying to create application in HTMLDB to store files via webbrowser in DB(BLOB). I created all needed components and now stuck with the problem of uploading big files. Basicaly when file is over 100MB it becomes unreliable and for big files does not work at all. Can somebody help me to figure out how to upload big files into htmldb application. Any hints and sugestions are welcome. Examples will be even more appreciated.
    Sincerely,
    Ian

    Ian,
    When you say "big files does not work at all", what do you see in the browser? Is no page returned at all?
    When a file is uploaded, it takes some amount of time to simply transfer the file from the client to modplsql. If you're on a local Gbit network, this is probably fast. If you're doing this over a WAN or over the Internet, this is probably fairly slow. As modplsql gets this uploaded file, it writes it to a temporary BLOB. Once fully received, modplsql will then insert this into the HTML DB upload table.
    I suspect that the TimeOut directive in Apache/Oracle HTTP Server is kicking in here. The default setting for this is 300 (5 minutes).
    I believe the timeout is reset by modplsql during file transfer to avoid a timeout operation while data is still being sent. Hence, I believe the insertion of your large file into the file upload table is taking longer than the TimeOut directive.
    The easy answer is to consider increasing your TimeOut directive for Apache/Oracle HTTP Server.
    The not so easy answer is to investigate why it takes so long for this insert, and tune the database accordingly.
    Hope this helps.
    Joel

  • Photoshop CC slow in performance on big files

    Hello there!
    I've been using PS CS4 since release and upgraded to CS6 Master Collection last year.
    Since my OS broke down some weeks ago (RAM broke), i gave Photoshop CC a try. At the same time I moved in new rooms and couldnt get my hands on the DVD of my CS6 resting somewhere at home...
    So I tried CC.
    Right now im using it with some big files. Filesize is between 2GB and 7,5 GB max. (all PSB)
    Photoshop seem to run fast in the very beginning, but since a few days it's so unbelievable slow that I can't work properly.
    I wonder if it is caused by the growing files or some other issue with my machine.
    The files contain a large amount of layers and Masks, nearly 280 layers in the biggest file. (mostly with masks)
    The images are 50 x 70 cm big  @ 300dpi.
    When I try to make some brush-strokes on a layer-mask in the biggest file it takes 5-20 seconds for the brush to draw... I couldnt figure out why.
    And its not so much pretending on the brush-size as you may expect... even very small brushes (2-10 px) show this issue from time to time.
    Also switching on and off masks (gradient maps, selective color or leves) takes ages to be displayed, sometimes more than 3 or 4 seconds.
    The same with panning around in the picture, zooming in and out or moving layers.
    It's nearly impossible to work on these files in time.
    I've never seen this on CS6.
    Now I wonder if there's something wrong with PS or the OS. But: I've never been working with files this big before.
    In march I worked on some 5GB files with 150-200 layers in CS6, but it worked like a charm.
    SystemSpecs:
    I7 3930k (3,8 GHz)
    Asus P9X79 Deluxe
    64GB DDR3 1600Mhz Kingston HyperX
    GTX 570
    2x Corsair Force GT3 SSD
    Wacom Intous 5 m Touch (I have some issues with the touch from time to time)
    WIN 7 Ultimate 64
    all systemupdates
    newest drivers
    PS CC
    System and PS are running on the first SSD, scratch is on the second. Both are set to be used by PS.
    RAM is allocated by 79% to PS, cache is set to 5 or 6, protocol-objects are set to 70. I also tried different cache-sizes from 128k to 1024k, but it didn't help a lot.
    When I open the largest file, PS takes 20-23 GB of RAM.
    Any suggestions?
    best,
    moslye

    Is it just slow drawing, or is actual computation (image size, rotate, GBlur, etc.) also slow?
    If the slowdown is drawing, then the most likely culprit would be the video card driver. Update your driver from the GPU maker's website.
    If the computation slows down, then something is interfering with Photoshop. We've seen some third party plugins, and some antivirus software cause slowdowns over time.

Maybe you are looking for