Zip compression stuttering

Hello,
I'm writing a program for Zip compressing some files but it's performance is quite odd. It zips the first four files very quickly and then stops for a long time (CPU usage=0%) when closing the 5th entry. Then it zips the next four files and stops again, this time when putting a new entry on the stream. Again, CPU usage=0%. Am I doing something wrong? Here's the code - the getfiles method returns all the files on a directory and is working correctly. Printing the letters a,b,c,d,e is only for debugging purposes.
public static void main(String[] args) throws Exception{
        //get the files
        ArrayList files = getFiles(new File(args[0]));
        int i=0, numFiles=files.size();
        File result = new File("aux.zip"), aux=null;
        byte[] buffer;
        BufferedInputStream in;
        ZipOutputStream out = new ZipOutputStream(new BufferedOutputStream(new FileOutputStream(result)));
        System.out.println("Number of files: "+numFiles);
        // Start the compression
        for (i=0; i<numFiles; i++) {
            aux = (File)files.get(i);
            System.out.println("Working on "+aux);
            in = new BufferedInputStream(new FileInputStream(aux));
            System.out.println("a");
            out.putNextEntry(new ZipEntry(aux.getPath()));
            System.out.println("b");
            int len;
            buffer = new byte[ (int)aux.length() ];
            while ((len = in.read(buffer)) > 0) {
                out.write(buffer, 0, len);
            System.out.println("c");
            out.closeEntry();
            System.out.println("d");
            in.close();
            System.out.println("e");
        out.close();
}Thanx in advance! :)

I tested the code with four small (<3kB) text files and once again, it blocked for a while closing the stream (not the entry) but it didn't create the zip file? Is my code OK?
I never debugged anything using that method, so I'd be thankful for some help. Here's what I got from Ctrl+Break:
Full thread dump Java HotSpot(TM) Client VM (1.5.0_01-b08 mixed mode):
"Low Memory Detector" daemon prio=5 tid=0x009c1ef0 nid=0x218 runnable [0x00000000..0x00000000]
"CompilerThread0" daemon prio=10 tid=0x009c09f8 nid=0x448 waiting on condition [0x00000000..0x0ac5f8bc]
"Signal Dispatcher" daemon prio=10 tid=0x009bfcb8 nid=0x1c8 waiting on condition [0x00000000..0x00000000]
"Finalizer" daemon prio=9 tid=0x009b70f8 nid=0x124 in Object.wait() [0x0abdf000..0x0abdfc64]
     at java.lang.Object.wait(Native Method)
     - waiting on <0x02a80850> (a java.lang.ref.ReferenceQueue$Lock)
     at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:116)
     - locked <0x02a80850> (a java.lang.ref.ReferenceQueue$Lock)
     at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:132)
     at java.lang.ref.Finalizer$FinalizerThread.run(Finalizer.java:159)
"Reference Handler" daemon prio=10 tid=0x009b5c08 nid=0x3f4 in Object.wait() [0x0ab9f000..0x0ab9fce4]
     at java.lang.Object.wait(Native Method)
     - waiting on <0x02a80760> (a java.lang.ref.Reference$Lock)
     at java.lang.Object.wait(Object.java:474)
     at java.lang.ref.Reference$ReferenceHandler.run(Reference.java:116)
     - locked <0x02a80760> (a java.lang.ref.Reference$Lock)
"main" prio=5 tid=0x00235ee0 nid=0x4e0 runnable [0x0006f000..0x0006fc38]
     at java.io.FileOutputStream.writeBytes(Native Method)
     at java.io.FileOutputStream.write(FileOutputStream.java:260)
     at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
     at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
     - locked <0x02aa6ed8> (a java.io.BufferedOutputStream)
     at java.io.FilterOutputStream.close(FilterOutputStream.java:140)
     at java.util.zip.DeflaterOutputStream.close(DeflaterOutputStream.java:144)
     at java.util.zip.ZipOutputStream.close(ZipOutputStream.java:310)
     at CryptoWorker.main(CryptoWorker.java:61)
"VM Thread" prio=10 tid=0x009b3208 nid=0x3d8 runnable
"VM Periodic Task Thread" prio=10 tid=0x009c3490 nid=0x2d4 waiting on condition

Similar Messages

  • I am trying to send minutes of a meeting to pc users by clicking on export and choosing the word option.  Recipients are unable to open them saying they came as a ZIP compressed folder.  No idea what that is or how to correct the problem.  Help!

    I am trying to send minutes of a meeting created in Pages to pc users by clicking on export then word.  Recipients are telling me they cannot open the minutes which have come as a ZIP compressed folder.  I have no idea what this is or how to fix the problem.  Help?!

    A pc user can open a .zip file by double clicking it.
    If that does not work, you can convert the document to a .pdf by doing the following.
    With the document active, type commannd + P  (the print command).
    In the next screen, on the bottom left, click on PDF, and in the drop down select Save as pdf...
    You will be asked where the .pdf should be saved - the desktop is the easiest.
    Now when you want to send the minutes, you have them as a .pdf file. Anyone with Adobe Acrobat Reder can open this.

  • Trying to zip / compress a file in Windows Server 2008 & SQL Server 2008 R2 server

    Hi,
    We are trying to zip / compress a xml file that has been created by retrieving data from SQL Server 2008 R2 database running on Windows Server 2008.
    To compress this file, we cannot use any external softwares like 7-zip or WinZip.
    So, we would like to know if there is any windows default compression tool that works on command line to compress the file?
    As this is a live server we cannot apply any other softwares.
    Please suggest any ways to do it in Windows Server 2008 machine.
    Thanks & Regards
    Kalyan

    Hello Kaylan,
    and for uncompress what can I use
    This is a way to do it in SSIS
    http://sqlblog.com/blogs/jorg_klein/archive/2009/08/27/ssis-unpack-a-zip-file-with-the-script-task.aspx
    Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

  • Adobe Acrobat X Pro ZIP Compression Creates Larger Files

    Hello,
    I made a flyer in InDesign CS 6 which contains a fairly complicated vector image made with Illustrator. When I export to PDF, InDesign creates a file of the size of 26 MB (ish). I then run preflight in Acrobat which finds that the vector image isn't compressed.
    Note that my PDF settings in InDesign are set to bicubic subsampling for colour images that are above 450 px and JPG compression.
    When I tell Acrobat to apply fixes, it tries to apply ZIP compression but the file size is then 38 MB. Could anyone shed light on this for me please? There is obviously something basic about vector images and compression that I am missing.
    It also finds elements that are completely off the board, although I didn't put anything there with InDesign.

    Test Screen Name: After seeing your response I run a little test. I made a PDF straight from Illustrator just using that image then preflighted it and I got the same error.
    I then opened that same PDF in Illustrator, a lot of that artwork was turned into images. I think it's the transparency flattener as I am converting to PDF/X-1A with compatibility for Acrobat 4 (which I should have probably mentioned in the first post but I didn't make the connection between the two). As far as I understand the transparency flattener converts an image into a mix of paths and rasters (according to Adobe's own help files.)
    Preset used for preflight is sheetfed offset CMYK btw.

  • How do I ZIP compress existing TIFF tiles in Lightroom 3?

    I have imported about 1000 .tif files into Lightroom and done some cropping and basic editing to them. They are 8bit uncompressed tiff files in Adobe1998 color space. I am trying to find a way to compress the original tiff files with ZIP compression in Lightroom. I don't want to export them because I want to save the original files and their edit history. I don't want to loose the original files before I cropped or color corrected them. I just want to reduce file sizes. Does anyone know how to do this?
    Thanks so much for your help!

    You can´t compress original files into zipped files within Lightroom.  If you are not actively using these images in LR, you may wish to zip them all up outside LR and then delete the originals. LR will then show them as missing, but will keep the metadata, including editing history, in the catalog.  You could write the metadata to xmp files before you zip up your originals, and include these xmp files with the originals in the zipped folder, if you want to play it really safe.  It is not necessary to keep the originals around as such.  LR keeps track of what they were and what had been done to them internally, even if they are missing.  When you need to work with these files again in LR, you can unzip them and show LR where they are.

  • Zip compression to windows

    I am having a semi frequent problem. I use the built in zip compression and compress the file. Half the time, window users when they unzip the file see empty files. Any suggestions.
    SJ

    stjoe57 wrote:
    That answer sort of begs the questions:
    1. Why can Mac users uncompress the zip files and see the files.
    Dunno. I suspect it's something to do with the compression algorithm used.
    2. Why do some window users users uncompress the zip files and see empty file.
    Dunno. I suspect it's something to do with the compression algorithm used.
    3. I really do not know who is going to uncompress these files. I just cannot tell them to get another file.
    I don't follow. I didn't tell you to use another file. Just another compression utility. Stuffit Expander has great compatibility across all platforms.

  • LR 2.5 won't export TIFF files with LZW or ZIP compression??

    I've just updated to LR2.5 and CR5.5, I'm using Vista Ultimate x64 on an AMD x2 64 bit pc.
    LR worked fine until 2.4 came along and hijacked all my auto play settings. Adobe finally releases 2.5 and now I find if I export TIFF files from a Nikon D700 NEF all I get is a black box the same size as the image??? If I turn LZW or ZIP compression off and export uncompressed the export works again. JPEG also exports ok.
    Anyone else getting this? Have you found out what's causing it?
    James.

    Thanks for the feedback Jao,
    I just tried across the whole range of TIFF options and the only files that don't give me a black file are 8bit and 16 bit with no compression. LZW and ZIP both stuff up
    Might try a complete uninstall and reinstall to see if that fixes things. These sorts of things only happen when you are in a rush to get lots of work done!
    Regards
    James

  • Disk Imaging, DMG, Zip, COmpressing

    Hi,
    I just downloaded a cool free software called FreeDMG which creates disk images. The problem is I'm not quite sure what it's used for! I know it creates .dmg files out of folders, i.e. creates a disk image, but what could I use this for? I know most program developers must use it to create the .dmg versions of their programs, but for a regular user....
    Is it a compression tool? Can I use it to reduce the size of some of my file folders for back up purposes? If not, what for?
    By the way are there other OS X solutions for compressing large file folders and reduce space occupied by a back up solution?
    thanks
    J

    Wade,
    I'm a pretty comfortable osx user and I'm targetting you with this question as you seem to have a lot of posts and that nifty developer icon. I'm well aware of how 10.4 pulled out from having stuffit in their systems and allowed for creation of native zip archives via Create Archive in the finder itself. I'm glad to have found out in my reading that zip natively now supports all resource forks as a designer using old school fonts.
    Here are some of my concerns for my workflow in prepping for archving work and looking towards a compatible future:
    -Is there a way to tweak default zip compressions settings to getting smaller archives?
    -What about RAR, I'm in the midst of trying to figure out if RAR has any support for resources forks often found in font files. An additional benefit that I see in RAR is the parity factor on windows boxes. (I'm aware of MacParDeluxe and Split and Concat as well) But essentially it would be great to cut down usage of programs to archive to say.. ONE. I'm not a windows user but I've seen some windows users workflows for archiving their work and they can create archivable, "paritied" segments of their projects, and set multiple to go and let their computers do compressing while they sleep.
    -which brings me to my next point: I'm a little peeved with my experience at DMG, ZIP, and STUFFIT. Here's why, keeping in mind, I'd love not to have to drop to command line to accomplish these tasks: Compress/decompress multiple folders of projects as separate archives simultaneously, maintain resource forks for legacy files-just in case.
    DMG: *.dmg's are great, yet I believe I've found a issue with them... try mounting 3-4dmg's on your desktop from a portable drive each dmg having a couple hundred files in them (images often in my case). Then grab all those mounted dmgs to a local drive. The copy begins with counting... and disappears at times, no warning... and incomplete... I've logged this on macintouch with no response and have tried this with similar results on numerous pristine systems.
    Also, in my experience in using a very nice program like DropDMG it does a GREAT job of creating dmgs for a folder at a time... but when attempting to set even two to go, one will error out.
    ZIP: Once again, happy to see that I can now preserve resource forks natively in OSX through "Creative Archive..." Bummed when I try on occasion to expand a folder of 24 zip archives at once (Apple+A, Apple+O in a folder) and occasionally they start erroring out... (seems to happen with fonts a lot in my experience). And again/addtionally, any way to tap into compression settings.
    STUFFIT: Aladdin...sigh They rose, they fell... OSX x'ed them, they seem to be better... but not quite. IMPRESSIVE compression with the stuffitX archives, but boy, they really start up the turbines on my machine and not to forget lets multitask the mac... I'd love to rightclick one folder after another and set 10 project folders to go overnight stuffing away.. but the instant proceed on the second archive while the first is going... i notice the first one either freezes or the progress bar stops givig me any accurate visual feedback.
    So Wade, perhaps I've been going about my archiving all wrong, but I do know some of my concerns are well grounded and as I'd love to set my system to crunch away while I sleep without a concern in the world at night, I really don't think I need to be baby sitting a program while archiving or unarching and I'd love to feel secure in whatever format I choose for archiving/future forecasting. Please do share any thoughts suggestions you have on all this.
    regards,
    erg8t

  • Zip/Compress a folder/file

    Hi
    recently i've try to Zip/Compress a folder...but funny...the folder is 15GB after compress...it still 15GB...haaa...
    Any problem?need helps..

    mactreouser wrote:
    But why i need the compress or Zip...that's because i need to backup my projects and files into DVDR.If,i do a compression on Video such as H.264 Quality to Low and Frame Rate 15...it'll be small the file...but it can't be use for Hi Quality project anymore...do you get what i wish?haaa...
    The problem is H.264 goes way beyond Zip in compression. Since you already applied H.264, there isn't anything else that Zip can do.
    If you want to preserve the quality, the only solution is to have big enough disks.
    I don't know whether my concept is on the track or not?!haaa...But i think it work..cause,sometimes we need to send file throught internet and we need to Zip it for email or transfering purpose..am i right?
    Probably not. When you send a document like a Word file, the text is not already compressed. There are still many patterns that can be condensed and spaces that can be closed up. When you zip that document, it can take advantage of all those opportunities for compression, and the file size goes down.
    But again, your H.264 files are already much smaller than uncompressed video. It's already crammed together as far as it will go unless you want to lose more quality. Therefore Zip cannot do anything more, and the file size stays the same.

  • Internally (zip) Compress table content possible?

    I have a database with approx 20 TABLEs which contain a lot of data.
    This database is rarely used (once for some hours every couple of weeks).
    When I generate SQL scripts (with INSERTs) to re-create the data the file size will be huge (approx 30 GB !!)
    When I zip compress these SQL scripts they will shrink to approx 20 MB !!!
    So the relationship between data size uncompress and compressed is remarkable 1:1500
    In order to avoid a waste of disc space I am thinking to let Oracle compress the data internally as well.
    The final solution should work something like:
    1.) Start Oracle services
    2.) Connect to databse
    3.) Tell Oracle (through SQLplus command): "Hey Oracle, uncompress internally all tables
    tab1, tab2, tab3,..., t20
    4.) Perform some SQL operations SELECT, UPDATE,...
    5.) Tell Oracle (through SQLplus command): "Hey Oracle, now re-compress internally all tables
    tab1, tab2, tab3,..., t20 again
    6.) Disconnect from database
    7.) Shutdown Oracle services
    Ok, I know compressing and uncompressing will take some minutes but this is acceptable for me.
    Is this somehow possible?
    Peter

    Great! Thank you.
    How do I enable TABLESPACE compression as it is mentioned on this page
    http://download.oracle.com/docs/cd/E11882_01/server.112/e17120/tables002.htm#ADMIN11630
    But when I go to the following page then there is no clause described for compression for TABLESPACEs
    http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/statements_3002.htm
    Is this a feature which needs to be explicitely enabled or is it build-in out-of-the-box in all version (Express, Standard, Enterprise) of Oracle?
    Peter

  • KeyNote files corrupted by Zip-compressing!

    I've heard of people getting KeyNote files corrupted so that they are unopenable. I'd never experienced it until I Zip-compressed the file in the finder. Upon uncompressing, the file is corrupt and will NOT open. Yikes!! (Fortunately, I have the original still).
    This is serious if it is general. Can anyone else tell me if they see this (and a possible solution to fix a file corrupted in this way).
    Info: KeyNote '08 (4.0.3), intel mac. System 10.5.2

    I have had that problem, and it happens when the source Keynote file is on an external (firewire) drive. If I copy the file to the root/main drive THEN zip it, it works fine.
    ....and this happens on multiple Macs and multiple external drives.

  • .ZIP compression

    I am using Stuffit to make .zip files Also have tried YemuZIP. After compression I upload them to my web space. I then try to send the link of the file to a couple of friends who use Windows 7 and XP. The file starts but upon end Windows gives an error message saying the file (zip) is invalid. Need some help with this. Also is there another format(s) that are both compatible for 10.6.6 and Windows?? Thanks!

    I downloaded FileZilla to get a look at the preferences. I'd suggest setting the File Types options as follows:
    It may not make any difference to undo the two checkboxes as I've done, but you never know.
    Or, give Fetch a try. A single user license is only $29. Here are the settings I use for uploading:
    Fetch does have a trial period of 15 days, so you don't need to purchase it immediately before finding out if it may resolve your issue.

  • Basic questions re zip, compression, and e-mailing large attachments

    Hi, I have never really understood what is meant by "zip" and compressing a file. 
    I believe these things make it possible to make a file smaller for sending via e-mail, and then when the person at the other end opens up the attachment, it returns to its full size in all its glory.  
    Is this true? 
    Reason I ask is that I have a couple of .mov files that I want to send as attachments to a friend, but they are both mammoth in size--1 gig each.
    I know it's probably a lost cause, but can compressing and zip help me out here?   Thanks for your patient replies.

    Yes, that's right. Read this to see how. http://docs.info.apple.com/article.html?path=Mac/10.6/en/8726.html. You'll have to experiment to see if you save enough space to send by email. Different Internet providers have different max file limits. Just try a test email attachment. Your sig says 10.5.8 and the article is for 10.6 but hopefully it is the same.

  • Can videos be zipped/compressed to email as smaller attachments?

    Could I do this if I purchased Quicktime rather than using the free download?
    Even an 8-second video I shot takes too long to email. My others are too large to send via my ISP.
    I tried zipping them using the "Compress" option but it didn't seem to work. When I checked "Get Info", they were the same size as the pre-zipped files.
    If Quicktime Pro does do this, will friends who don't have Quicktime be able to unzip and watch them?
    Also, does Quicktime Pro allow video capture?
    Thanx.

    *Some suggestions regarding sending large files:*
    If you both have High-speed connections, the easiest & fastest way is through AIM (AOL Instant Messenger) or any IM that has file transfers.
    I send all my music & movie files this way instead of using email.
    iChat has the same ability of transferring large files as AIM.
    http://docs.info.apple.com/article.html?artnum=150934
    Adium has file transfers.
    Yahoo Messenger has file transfers.
    If you must use email, check out YouSendIt for large & small file transfers.

  • Multiple zip with same zip compression

    Hi,
    I have a number of small texts, say 100-1000 bytes. They contain similar kind of texts and if I zip with all of them together it gives excellent compression. However, I need to zip them 1 by 1, since I will later access only one of them and I don't want to fetch all texts, I only need one. The problem with java.util.zip is that it gives almost no compression for small sets of data since it indludes compression information for each compressed set of data. I therfore want to do something like this:
    -------------- code --------------
    String[] allStrings=...;
    byte[][] allCompressedStrings=new byte[allStrings.length][];
    // 1. Make a common compression deflater, with a given
    // "dictionary", for all texts/Strings I want to compress
    String dictionary=...;//eg concatenate all String in allStrings.
    Deflater compresser = new Deflater();
    compresser.setDictionary(dictionary.getBytes());
    // 2. Compress all Strings to compressed data which does NOT
    // include the compression information/tree/whatever.
    for(int i=0; i<allStrings.length; i++){
    compresser.setInput(allStrings);
    allCompressedStrings[i]=new byte[...];
    int compressedLength=compresser.deflate(allCompressedStrings[i]);
    // 3. Make a decompressor/inflater with the same
    // "dictionary"
    Inflater decompresser = new Inflater();
    decompresser.setDictionary(dictionary.getBytes());
    // 4. Given the inflater we can decompress any of the�
    // compressed texts.
    decompresser.setInput(allCompressedStrings[x]);
    byte[] result = new byte[x];
    int resultLength = decompresser.inflate(result);
    decompresser.end();
    String originalString=new String(result, 0, resultLength);
    ------------ end code ------------
    However, decompresser.setDictionary(...) will give the following error:
    java.lang.IllegalArgumentException
         at java.util.zip.Inflater.setDictionary(Native Method)
         at java.util.zip.Inflater.setDictionary(Inflater.java:139)
         at java.util.zip.Inflater.setDictionary(Inflater.java:153)
    I have 4 questions:
    1. Is it possible to do what I am trying to do java.util.zip.* - to have a separate compression information detached from the compressed data - the compressed data does not contain the compression information/tree/whatever
    2. If it's not, is there any other library better suited for this job?
    3. Why do I get this error when I call Inflater.setDictionary(...)?
    4. Compression does give other result, and it is smaller, if I first set dictionary for the deflater (compressor.setDictionary(...)). Does that mean that the compression information/tree/whatever is not included in that compressed data? I can surely not decompress that compressed data anyway if I don't set the dictionary for the inflater(decompressor.setDirctionary(...)) (but then I cannot set the dictionary for the inflater)
    Gil

    Gilroitto,
    Here is the deal:
    I am trying to compress a java object in the form of bytes and then send that compressed data across the network adn trying to decompressing that using the inflate method of the inflater class but it gives me the following error :
    java.lang.InternalError: need dictionary
         at java.util.zip.Inflater.inflateBytes(Native Method)
         at java.util.zip.Inflater.inflate(Inflater.java:195)
         at java.util.zip.Inflater.inflate(Inflater.java:212)
         at crDecompToRMS.executeBusinessRules(crDecompToRMS.java:69)
         at com.stc.jcsre.JCollaboration.translate(JCollaboration.java:148)
         at com.stc.common.collabService.JCCollabControllerImpl.translate(JCCollabControllerImpl.java:528)
    Can you help me find out what values should be set to the dictionary on both the sides (deflater and inflater)
    Following is my java code for inflater
    byte[] compressedData = getEtdBytesIn().get_Data();
    Inflater decompressor = new Inflater();
    decompressor.setInput(compressedData);
    // Create an expandable byte array to hold the decompressed data
    ByteArrayOutputStream bos1 = new ByteArrayOutputStream(compressedData.length);
    // Decompress the data
    byte[] buf1 = new byte[1024];
    while (!decompressor.finished()) {
    try {
    int count = decompressor.inflate(buf1);
    bos1.write(buf1, 0, count);
    } catch (DataFormatException e) { }
    try {
    bos1.close();
    } catch (IOException e) {}
    // Get the decompressed data
    byte[] decompressedData = bos1.toByteArray();
    String o = new String (decompressedData);
    System.err.println("decompresseddata lengtht is " + decompressedData.length);
    System.err.println("decompresseddata is " + o);
    getEtdRibMessageOut(decompressedData);
    It would be great if you could send me your complete source code which works
    Thanks,
    Navin

Maybe you are looking for

  • Converting a flash movie to a gif

    I have a movie clip API that allows a user to draw diagrams on my site. When the user hit an OK button I need an action script that will convert that to an image file so that it then can be stored in a db.

  • Can i use flash for ui and interact with c++ builder for the rest

    i know flash can be used in c# in visual studio but i dont remember a thing of this interaction. is it possible to interact with c++ builder and how? the scenario is simple use flash for UI (showing-viewing data) maybe for a kiosk or something withou

  • Automatically adjust levels in a track to create a common "volume"

    Sorry for the dumb question but I am totally new to audio. I have recorded a conference where there were multiple speakers sitting different distances away from 2 microphones. Therefore, the levels of each speaker are different due to their differing

  • Making fields vieabel in my extractor

    I am working with an extracotr and I need to change the fiedls so some are visible.  wher do I do this?  I tried several places but i can't chinge them

  • "Photo has Develop adjustments" when none made

    Hello, I am importing a JPG photo into Lightroom 5.4. In the Import screen, in the "Apply During Import" section, both the "Develop Settings" and the "Metadata" fields are set to "None". Yet, as the import process progresses, I see the correct thumbn