Archive Utility .zips aren't always compatible

I am using the standard Mac OSX archive utility (ctrl-click and select Create Archive of "X") to zip a folder of files for upload to a website (where they are to be decompressed).
If I use Winzip in Windows on my PC... no problem.
If I use the archive utility in Mac OSX, my website spits back an error saying the first file is missing from the archive and it gives up. (The file is there if I decompress the zip file locally).
This is not the first time I've found problems with the Mac's .zip files. For example, PHPMyAdmin rejects the Mac's .zip files as being the wrong size.
Anyone know what's going on and a way around it.
I have yet to get a grasp of the command line, but would using gzip be a better idea? How do I gzip an entire folder? Anyone know a good free zip utility that will not produce this error?
Thanks very much for any advice/ideas in advance
Jim
12" iBook G4 1.25GHz   Mac OS X (10.4.6)  

Arggg!! I hate Stuffit!! Ever since System 8!
In any event, if PHPAdmin doesn't like your ZIP files, it certainly isn't going to take a Stuffit file.
On www.versiontracker.com there should be lots of free dropzip and droptar, dropgz utilities to do what you want.
You can also type "tar -zcvf <archive>.tar.gz <folder>" in the Terminal, where "<folder>" is the folder you want to archive and <archive> is the name of the archive you want to create.

Similar Messages

  • Archive-utility (zip) doesn't work..?!

    hi there,
    after a re-installation of my system because of a hardware-problem with my harddisk, everytime i'm trying to unzip a zip-file i get a error-message about ArchiveUtility, saying 'fout 5 - Invoer-/uitvoerfout. (in Dutch) so my ArchiveUtility apparently doesn't work properly.
    - Can i re-install this utility?
    - or maybe fix the problem any other way?
    thanx from Amsterdam
    jorma

    ZipIt should work.
    http://www.maczipit.com/download.html
    Check out the new remodeled MacOSG website! 24-hour Apple-related news & support.
     MacOSG: An Apple User Group  iTunes: MacOSG Podcast  Follow us on Twitter: MacOSG

  • Cannot unzip .zip even with Archive Utility

    Hi,
    I have problem unzipping a .zip file. When I use the Archive Utility to unzip it, it yields a file with the same name with .zip.cpgz on its end. When I subsequently make another trial - to unzip this new file, it yields the very same file only with .zip.cpgz 2 in the end of its name. A repeated process (now with any of these files, either original, first .cpgz or second .cpgz 2) yields a file with appropriate .cpgz #. Repeating the process further seemed to me futile. I hope writing here would in the long run yield an unzipped original .zip file.
    Many thanks for your help,
    pwyll.

    You probably won't see this, but did you ever zip a file during this time and then unzip it with another program and find data missing? The same thing happened to me where I zipped an assignment with archive utility, then when I tried to unzip it it would just make copy after copy. Once it was unzipped by my professior there was missing data. THen when I downloaded another program to unzip the original zipped file, that data was missing, too! I tried it again and zipping the file kep deleting part of my file!

  • Unable to open zip files with Archive Utility or StuffIt

    Hello,
    I am running Mac OS X 10.7.3.  I have been attempting to download and install the Eclipse Java IDE from both www.eclipse.org and from a Stanford course website.  In the first case the file is offered as a tar.gz and in the second case it is a .zip.  When I attempt to open either file using Archive Utility or StuffIt Expander I get a never ending pinwheel.  I am forced to restart to get Finder working porperly again and quiet the fan down.  My wife's computer, also running Mac OS X 10.7.3, can extract the files without a problem.

    Jsanders is basiclly a BlackBerry Superhero, stick around for awhile, Don't be a stranger AntMcl, you can learn a lot around here I promise.
    If someone helped you give them kudos. Research all info!

  • Archive Utility brings up error message when trying to unarchive protected zip file

    Hey there,
    I've been zipping images with password protection using different applications, some with a Lightroom Plug-In Zip-Exporter, some with a stand alone app such as "Archiver". Now when I try to unzip these images on OSX 10.6 the Archive Utility brings up an the error: "Unable to unarchive "Name of File" into "Desktop". (Error 1 - Operation not permitted.) I'm logged in with an admin account. I tried this on a macbook pro and on an imac, both 10.6, same problem. Now when I try to unzip the file using third party such as Stuffit expander or Archiver, it unzips the files without a problem.
    any idea what's wrong with the OSX Archive Utility?

    Nothing's wrong with it except that it doesn't support encrypted .zip files.  You'll just have to use third-party software, or a Terminal command, to unzip those.

  • Pdf file causing archive utility to throw error

    I have a couple of pdf files which cannot be compressed without an error. Supposing that the nasty file is called foo.pdf.
    . In the Finder, right click on foo.pdf
    . Select Compress "foo.pdf"
    A file called foo.pdf.zip is created but an error pops up An error occurred while compressing a file. Strangely enough, the error window has a titlebar called "Copy".
    When looking in the Console, there is always an error from mdworker listed:
    2/24/2009 10:23:37 /System/Library/Frameworks/CoreServices.framework/Frameworks/Metadata.framework /Versions/A/Support/mdworker[20524] zip importer countered an error (2) scanning "/Path/to/foo.pdf.zip"
    This same file also always errors out when trying to use -ditto- in a Terminal window. (See this minithread: http://discussions.apple.com/thread.jspa?threadID=1724912 )
    FWIW, attempting to open foo.pdf.zip causes the Archive Utility to throw the error
    Unable to unarchive "foo.pdf.zip" into "Wherever".
    Error 1 - Operation not permitted
    Does anyone have any idea what could be causing the problem?
    Bill

    Nothing's wrong with it except that it doesn't support encrypted .zip files.  You'll just have to use third-party software, or a Terminal command, to unzip those.

  • Archive Utility won't auto Quit anymore

    Prior to updating my March 2009 Duo Core iMac to Yosemite, Archive Utility always Auto Quit immediately after expanding Zip archives.  But now in Yosemite, Archive Utility expands the archive but then stays open (green icon remains in the Dock with black dot beneath).  And sadly, I see nothing within Archive Utility's preferences to "Auto Quit."  How do I make Archive Utility AUTO QUIT under OS X Yosemite?
    Thanks.

    Surely some of you experienced people here in this forum must know.
    I look forward to your kind advice and insights.
    Thank you.

  • Archive Utility problem

    Hello I am having a problem with compressing files when I right click and try to compress (zip) files. An error messages comes up that says "the contents list cannot be created for compressing."
    It works again if I restart, but it stops working again after awhile.
    I have tried repairing permissions and running Applejack to no avail.
    I have the latest Mac Os Leopard
    Any ideas? I tried deleting the archive utility preferences.

    HI Kevin,
    Make sure you have enough free disk space.
    Right or control click the MacintoshHD icon. Click Get Info. In the Get Info window you will see Capacity and Available. Make sure you always have a minimum of 10% to 15% free disk space at all times.
    If you have any third party compression software installed, that could be causing the problem.
    Download and install the 10.6.2 combo update and see if that helps.
    http://support.apple.com/kb/DL959
    Carolyn
    Message was edited by: Carolyn Samit

  • Missing the Archive Utility.app

    Hello all,
    It has taken me a while to discover this, but I am completely missing the Archive Utility that comes with the OS from the Core Services folder in the library. I cannot find the app anywhere on my computer and I think my kids have somehow deleted it. I cannot find a way to re-install that program from my system install disks, and I cannot find the program at Apple.com for download. Any suggestions? It is a pain not to have it in my system!

    Thanks for giving the directory path - I have wanted to do something about this app for some time and could find almost no information on it.
    My system (OS 10.4.11) launches BOMArchivehelper.app as the default for various compressed files (.zip, .rar, etc.), and for this purpose it seems nearly, if not completely, useless. Instead I launch Stuffit (or right-click, "open with") and either open compressed files or drag and drop. Once in a while I forget and double click a file's Finder icon, and almost always regret it. Did this about two hours ago for a ~ 75 MB zip file and the little sourcer's apprentice is still grinding away with the progress bar moving about about 1 mm every 20 minutes. There is no program icon in the dock and if I call up the Force Quit Applications panel, the utility is no where to be seen.* I'm torn between ignoring the useless little troll of a program and shutting everything down, so I can reboot and get it out of my sight.
    I finally reset the default for zip files to Stuffit, so it shouldn't happen again, but I'd like to know if there ius a real use for BOM, or is it just there because Apple felt obligated to include thi type of app in the operating system?

  • Java.util.zip.ZipException: a device attached to the system is not function

    getting a java.util.zip.zipexception : a device attached to the system is not functioning error - what could cause such an error?
    My program finds all zip files in an archive and then searches through them for xls files, which it extracts and re-locates.
    I havent even a clue where to look for the cause of this exception but Ill attach at the bottom the code in the general vicitiny of the trigger so that you can get kind of an idea what Im trying to do, and if im lucky, even spot my problem. :) Thanks!!
    //zips is an array of zip files
    int found = 0;
    File[] haveXLs = new File[zips.length];
    for (int i = 0; i < zips.length; i++){
    String fileName = new String("L:/Vision/Archive/" + zips.getName());
    ZipFile archive = new ZipFile(fileName);
    String name = zips[i].getName().substring(0,8);
    for(Enumeration e = archive.entries(); e.hasMoreElements();){
    ZipEntry entry = (ZipEntry) e.nextElement();
    if(entry.getName().substring(0,8) == name){
    haveXLs[found] = zips[i];
    found++;

    Hey there a few things.
    Make sure that you dont use fileseparators like you do. ("/")
    Use the separator generated for your system.
    Something like:
    String sep = System.getProperty("file.separator");
    You mentioned it work local, but not network.
    Either you have plenty of harddrives or L: is a mapped drive.
    Is it working at the mapped drive?
    When you say on the network, how are you accessing the files?
    Could it be possible for another user to lock a file, so you wont have access to it over the network?
    BR.
    MagDy

  • Java.util.zip.ZipException Error

    I created a jar file, and put in C:\tools
    C:\tools>java -jar myjar.jar is working fine
    However, if I try to run myjar.jar in other directories, then I have problems.
    I already set the classpath:
    SET CLASSPATH=.;%CLASSPATH%;C:\tools\myjar.jar;
    Here's the error. Any ideas???
    C:\>java -jar myjar.jar
    Exception in thread "main" java.util.zip.ZipException: The system cannot find th
    e file specified
    at java.util.zip.ZipFile.open(Native Method)
    at java.util.zip.ZipFile.<init>(ZipFile.java:112)
    at java.util.jar.JarFile.<init>(JarFile.java:117)
    at java.util.jar.JarFile.<init>(JarFile.java:55)

    You always need to specify a proper file name when you use the -jar switch. If you are not in c:\tools you have to run with "java -jar c:\tools\myjar.jar".
    Setting the classpath in particular doesn't help becuase the file name given to the -jar switch will override all settings for classpath. http://java.sun.com/j2se/1.4/docs/tooldocs/findingclasses.html#userclass
    But since you now have myjar.jar in your classpath, you can run the application from any directory with "java your.main.ClassName" :)

  • Java.lang.Error: java.util.zip.ZipException: The system cannot find the fil

    I got maven 221 installed
    i got jdk 1.6 and 1.5 installed (have tested both)
    I have a strange error. All my co-workers can build but I cant. The only thing I can find is that I dont have installed BEA Weblogic but I dont want to have that installed. It should be able to run anyway.
    Could someone tell me what is wrong? If you need pom.xml I got that one as well.
    process-classes:
    [copy] Copying 4 files to C:\hudson\jobs\albpm_ip-identity-asserter_-_Build\workspace\target\mbean-content
    [mkdir] Created dir: C:\hudson\jobs\albpm_ip-identity-asserter_-_Build\workspace\target\mbean-jar
    [java] Creating an MJF from the contents of directory C:\hudson\jobs\albpm_ip-identity-asserter_-_Build\workspace\target\mbean-content...
    [java] Compiling the files...
    [java] Creating the list.
    [java] Doing the compile.
    [java] WLMaker-SubProcess: : Exception in thread "main" java.lang.Error: java.util.zip.ZipException: The system cannot find the file specified
    [java] WLMaker-SubProcess: :      at weblogic.management.commo.BeanGenDriver.getManagementTempDir(BeanGenDriver.java:93)
    [java] WLMaker-SubProcess: :      at weblogic.management.commo.BeanGenDriver.main(BeanGenDriver.java:117)
    [java] WLMaker-SubProcess: : Caused by: java.util.zip.ZipException: The system cannot find the file specified
    [java] WLMaker-SubProcess: :      at java.util.zip.ZipFile.open(Native Method)
    [java] WLMaker-SubProcess: :      at java.util.zip.ZipFile.<init>(ZipFile.java:203)
    [java] WLMaker-SubProcess: :      at java.util.jar.JarFile.<init>(JarFile.java:132)
    [java] WLMaker-SubProcess: :      at java.util.jar.JarFile.<init>(JarFile.java:97)
    [java] WLMaker-SubProcess: :      at weblogic.management.commo.BeanGenDriver.getManagementTempDir(BeanGenDriver.java:90)
    [java] WLMaker-SubProcess: :      ... 1 more
    [java] WLMaker-SubProcess: : Stopped draining WLMaker-SubProcess:
    [java] WLMaker-SubProcess: : Stopped draining WLMaker-SubProcess:
    [java] BeanGen code generation failed
    [HUDSON] Archiving C:\hudson\jobs\albpm_ip-identity-asserter_-Build\workspace\pom.xml to C:\hudson\jobs\albpmip-identity-asserter_-Build\modules\dk.skat.ip.integration.albpm$ip-identity-asserter\builds\2010-11-2213-41-28\archive\dk.skat.ip.integration.albpm\ip-identity-asserter\1.2\pom.xml
    [INFO] ------------------------------------------------------------------------

    from my experience, using weblogic jars can be a pain if the full install is not on the local box.
    Note that you dont have to 'install' it. Just copy the directory.
    Reason is that the jar files have manifests with relative classpaths.
    For an example of horror take a look at the weblogic.jar MANIFEST's classpath entry.
    -Fred

  • What is the maximum file size allowed by Yosemite's Archive Utility?

    I've seen radically different answers to this question, ranging from ".zip files have a 4GB size limit" to "no limit other than the OS maximum file size". It's been very difficult to find current info on this.
    I have lots of large folders full of recording projects --- I'm talking up to 45GB or so --- and I've been experimenting with different methods of zipping them in preparation for cloud backup. Several applications have been willing to zip my enormous folders into archives, but then choke when unzipping them, telling me that the files cannot be unzipped or are corrupted. Using the "Compress" shortcut in the finder has so far yielded the best results, keeping all necessary resource forks, etc., and unzipping properly, even when other apps have insisted the files are corrupted. However, I'm afraid to continue with this procedure until I can get a straight answer on this issue: have I just been lucky so far? IS there an actual size limit?
    ...It only seems to work when I both zip and unzip with the Archive Utility. Other archiving apps will either render the included projects unreadable by my recording software when zipping (I suspect because of alteration or stripping of resource forks), or will refuse to read the giant .zip archives generated by Archive Utility.
    I've set up the Archive Utility to produce .zip files, as I feel these are the most likely to be recognized by a variety of cloud storage services.ny
    ...Any guidance would be greatly appreciated!

    Hi,
    The 1,048,576 rows & 16,384 columns is the
    workbook size limitation in Excel 2013. Thus, I recommend we try the Mr. Bernie's suggestions to import the large CSV file.
    1. Use VBA to read the file line by line and split/examine the import file in sections. If you have further question about the VBA, please post your question to the MSDN forum for Excel
    http://social.msdn.microsoft.com/Forums/en-US/home?forum=exceldev&filter=alltypes&sort=lastpostdesc
    2. Use Excel 2013 add-ins. Power Pivot and Power Query. For more detailed information, please see the below articles: 
    http://social.technet.microsoft.com/Forums/en-US/9243a533-4575-4fd6-b93a-4b95d21d9b10/table-with-more-than-1-048-576-rows-in-power-query-excel-2013?fo
    http://www.microsofttrends.com/2014/02/09/how-much-data-can-powerpivot-really-manage-how-about-122-million-records/
    Please Note: Since the web site is not hosted by Microsoft, the link may change without notice. Microsoft does not guarantee the accuracy of this information.
    Thanks
    George Zhao
    Forum Support
    Come back and mark the replies as answers if they help and unmark them if they provide no help.
    If you have any feedback on our support, please click "[email protected]"

  • Cannot extract Zip file with Winzip after zipping with java.util.zip

    Hi all,
    I write a class for zip and unzip the text files together which can be zip and unzip successfully with Java platform. However, I cannot extract the zip file with Winzip or even WinRAR after zipping with Java platform.
    Please help to comment, thanks~
    Below is the code:
    =====================================================================
    package myapp.util;
    import java.io.* ;
    import java.util.TreeMap ;
    import java.util.zip.* ;
    import myapp.exception.UserException ;
    public class CompressionUtil {
      public CompressionUtil() {
        super() ;
      public void createZip(String zipName, String fileName)
          throws ZipException, FileNotFoundException, IOException, UserException {
        FileOutputStream fos = null ;
        BufferedOutputStream bos = null ;
        ZipOutputStream zos = null ;
        File file = null ;
        try {
          file = new File(zipName) ; //new zip file
          if (file.isDirectory()) //check if it is a directory
         throw new UserException("Invalid zip file ["+zipName+"]") ;
          if (file.exists() && !file.canWrite()) //check if it is readonly
         throw new UserException("Zip file is ReadOnly ["+zipName+"]") ;
          if (file.exists()) //overwrite the existing file
         file.delete();
          file.createNewFile();
          //instantiate the ZipOutputStream
          fos = new FileOutputStream(file) ;
          bos = new BufferedOutputStream(fos) ;
          zos = new ZipOutputStream(bos) ;
          this.writeZipFileEntry(zos, fileName); //call to write the file into the zip
          zos.finish() ;
        catch (ZipException ze) {
          throw ze ;
        catch (FileNotFoundException fnfe) {
          throw fnfe ;
        catch (IOException ioe) {
          throw ioe ;
        catch (UserException ue) {
          throw ue ;
        finally {
          //close all the stream and file
          if (fos != null)
         fos.close() ;
          if (bos != null)
         bos.close();
          if (zos != null)
         zos.close();
          if (file != null)
         file = null ;
        }//end of try-catch-finally
      private void writeZipFileEntry(ZipOutputStream zos, String fileName)
          throws ZipException, FileNotFoundException, IOException, UserException {
        BufferedInputStream bis = null ;
        File file = null ;
        ZipEntry zentry = null ;
        byte[] bArray = null ;
        try {
          file = new File(fileName) ; //instantiate the file
          if (!file.exists()) //check if the file is not exist
         throw new UserException("No such file ["+fileName+"]") ;
          if (file.isDirectory()) //check if the file is a directory
         throw new UserException("Invalid file ["+fileName+"]") ;
          //instantiate the BufferedInputStream
          bis = new BufferedInputStream(new FileInputStream(file)) ;
          //Get the content of the file and put into the byte[]
          int size = (int) file.length();
          if (size == -1)
         throw new UserException("Cannot determine the file size [" +fileName + "]");
          bArray = new byte[(int) size];
          int rb = 0;
          int chunk = 0;
          while (((int) size - rb) > 0) {
         chunk = bis.read(bArray, rb, (int) size - rb);
         if (chunk == -1)
           break;
         rb += chunk;
          }//end of while (((int)size - rb) > 0)
          //instantiate the CRC32
          CRC32 crc = new CRC32() ;
          crc.update(bArray, 0, size);
          //instantiate the ZipEntry
          zentry = new ZipEntry(fileName) ;
          zentry.setMethod(ZipEntry.STORED) ;
          zentry.setSize(size);
          zentry.setCrc(crc.getValue());
          //write all the info to the ZipOutputStream
          zos.putNextEntry(zentry);
          zos.write(bArray, 0, size);
          zos.closeEntry();
        catch (ZipException ze) {
          throw ze ;
        catch (FileNotFoundException fnfe) {
          throw fnfe ;
        catch (IOException ioe) {
          throw ioe ;
        catch (UserException ue) {
          throw ue ;
        finally {
          //close all the stream and file
          if (bis != null)
         bis.close();
          if (file != null)
         file = null ;
        }//end of try-catch-finally
    }

    Tried~
    The problem is still here~ >___<
    Anyway, thanks for information sharing~
    The message is:
    Cannot open file: it does not appear to be a valid archive.
    If you downloaded this file, try downloading the file again.
    The problem may be here:
    if (fos != null)
    fos.close() ;
    if (bos != null)
    bos.close();
    if (zos != null)
    zos.close();
    if (file != null)
    file = null ;
    The fos is closed before bos so the last buffer is not
    saved.
    zos.close() is enough.

  • Cannot use winzip to unzip the zip file zipped by java.util.zip

    Hi all,
    I use the followcode to create a zip file, and i downlaod it and try to use winzip to unzip this file but fail. The path is correct and i got the zip file. but it just cannot unzip.
    pls help
    thanks alot.
    Kin
              int count = 0;
              count = ContentDocuments.size();
              for (int i = 0; i < bb; i++)     {
                   System.out.println(filenames[i] + "");
              // Create a buffer for reading the files
              byte[] buf = new byte[10*1024*1024];
              try {      
                   String outFilename = MyDir + "zipfile/" + getContentID2()+".zip";
                   System.out.println("outFilename = " + outFilename);
                   ZipOutputStream out = new ZipOutputStream(new FileOutputStream(outFilename));
                   for (int i=0; i<filenames.length; i++) {           
                        FileInputStream in = new FileInputStream(filenames);
                        out.putNextEntry(new ZipEntry(filenames[i]));
                        int len;
                        while ((len = in.read(buf)) != -1) {               
                             out.write(buf, 0, len);
                        out.closeEntry();
                        in.close();
                   out.close();
              } catch (IOException e)     {
                   System.err.println("zipprocess " + e.getMessage());

    I've written a replacement zip file creator class. Not much tested but it seems to work, however I've yet to try it with the version of WINZIP that rejected my previous attempts. Oh, and the stored dates are garbage.
    * ZipOutputFile.java
    * Created on 25 March 2004, 13:08
    package zip;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    * <p>Creates a ZIP archive in a file which WINZIP should be able to read.</p>
    * <p>Unfortunately zip archives generated by the standard Java class
    * {@link java.util.zip.ZipOutputStream}, while adhering to PKZIPs format specification,
    * don't appear to be readable by some versions of WinZip and similar utilities. This is
    * probably because they use
    * a format specified for writing to a non-seakable stream, where the length and CRC of
    * a file is writen to a special block following the data. Since the length of the binary
    * date is unknown this makes an archive quite complicated to read, and it looks like
    * WinZip hasn't bothered.</p>
    * <p>All data is Deflated. Close completes the archive, flush terminates the current entry.</p>
    * @see java.util.zip.ZipOutputStream
    * @author  Malcolm McMahon
    public class ZipOutputFile extends java.io.OutputStream {
        byte[] oneByte = new byte[1];
        java.io.RandomAccessFile archive;
        public final static short DEFLATE_METHOD = 8;
        public final static short VERSION_CODE = 20;
        public final static short MIN_VERSION = 10;
        public final static int  ENTRY_HEADER_MAGIC = 0x04034b50;
        public final static int  CATALOG_HEADER_MAGIC = 0x02014b50;
        public final static int  CATALOG_END_MAGIC = 0x06054b50;
        private final static short DISC_NUMBER = 0;
        ByteBuffer entryHeader = ByteBuffer.wrap(new byte[30]);
        ByteBuffer entryLater = ByteBuffer.wrap(new byte[12]);
        java.util.zip.CRC32 crcAcc = new java.util.zip.CRC32();
        java.util.zip.Deflater def = new java.util.zip.Deflater(java.util.zip.Deflater.DEFLATED, true);
        int totalCompressed;
        long MSEPOCH;
        byte [] deflateBuf = new byte[2048];
        public static final long SECONDS_TO_DAYS = 60 * 60 * 24;
         * Entry stores info about each file stored
        private class Entry {
            long offset;        // position of header in file
            byte[] name;
            long crc;
            int compressedSize;
            int uncompressedSize;
            java.util.Date date;
             * Contructor also writes initial header.
             * @param fileName Name under which data is stored.
             * @param date  Date to label the file with
             * @TODO get the date stored properly
            public Entry(String fileName, java.util.Date date) throws IOException {
                name = fileName.getBytes();
                this.date = date == null ? new java.util.Date() : date;
                entryHeader.position(10);
                putDate(entryHeader);
                entryHeader.putShort(26, (short)name.length);
                offset = archive.getFilePointer();
                archive.write(entryHeader.array());
                archive.write(name);
                catalog.add(this);
                crcAcc.reset();
                totalCompressed = 0;
                def.reset();
             * Finish writing entry data. Save the lenghts & crc for catalog
             * and go back and fill them in in the entry header.
            public void close() throws IOException {
                def.finish();
                while(!def.finished())
                    deflate();
                entryLater.position(0);
                crc = crcAcc.getValue();
                compressedSize = totalCompressed;
                uncompressedSize = def.getTotalIn();
                entryLater.putInt((int)crc);
                entryLater.putInt(compressedSize);
                entryLater.putInt(uncompressedSize);
                long eof = archive.getFilePointer();
                archive.seek(offset + 14);
                archive.write(entryLater.array());
                archive.seek(eof);
             * Write the catalog data relevant to this entry. Buffer is
             * preloaded with fixed data.
             * @param buf Buffer to organise fixed lenght part of header
            public void writeCatalog(ByteBuffer buf) throws IOException {
                buf.position(12);
                putDate(buf);
                buf.putInt((int)crc);
                buf.putInt(compressedSize);
                buf.putInt(uncompressedSize);
                buf.putShort((short)name.length);
                buf.putShort((short)0);  // extra field length
                buf.putShort((short)0);  // file comment length
                buf.putShort(DISC_NUMBER);  // disk number
                buf.putShort((short)0); // internal attributes
                buf.putInt(0);      // external file attributes
                buf.putInt((int)offset); // file position
                archive.write(buf.array());
                archive.write(name);
             * This writes the entries date in MSDOS format.
             * @param buf Where to write it
             * @TODO Get this generating sane dates
            public void putDate(ByteBuffer buf) {
                long msTime = (date.getTime() - MSEPOCH) / 1000;
                buf.putShort((short)(msTime % SECONDS_TO_DAYS));
                buf.putShort((short)(msTime / SECONDS_TO_DAYS));
        private Entry entryInProgress = null; // entry currently being written
        private java.util.ArrayList catalog = new java.util.ArrayList(12);  // all entries
         * Start a new output file.
         * @param name The name to store as
         * @param date Date - null indicates current time
        public java.io.OutputStream openEntry(String name, java.util.Date date) throws IOException{
            if(entryInProgress != null)
                entryInProgress.close();
            entryInProgress = new Entry(name, date);
            return this;
         * Creates a new instance of ZipOutputFile
         * @param fd The file to write to
        public ZipOutputFile(java.io.File fd) throws IOException {
            this(new java.io.RandomAccessFile(fd, "rw"));
         * Create new instance of ZipOutputFile from RandomAccessFile
         * @param archive RandomAccessFile
        public ZipOutputFile(java.io.RandomAccessFile archive) {
            this.archive = archive;
            entryHeader.order(java.nio.ByteOrder.LITTLE_ENDIAN);  // create fixed fields of header
            entryLater.order(java.nio.ByteOrder.LITTLE_ENDIAN);
            entryHeader.putInt(ENTRY_HEADER_MAGIC);
            entryHeader.putShort(MIN_VERSION);
            entryHeader.putShort((short)0);  // general purpose flag
            entryHeader.putShort(DEFLATE_METHOD);
            java.util.Calendar cal = java.util.Calendar.getInstance();
            cal.clear();
            cal.set(java.util.Calendar.YEAR, 1950);
            cal.set(java.util.Calendar.DAY_OF_MONTH, 1);
    //        def.setStrategy(Deflater.HUFFMAN_ONLY);
            MSEPOCH = cal.getTimeInMillis();
         * Writes the master catalogue and postamble and closes the archive file.
        public void close() throws IOException{
            if(entryInProgress != null)
                entryInProgress.close();
            ByteBuffer catEntry = ByteBuffer.wrap(new byte[46]);
            catEntry.order(java.nio.ByteOrder.LITTLE_ENDIAN);
            catEntry.putInt(CATALOG_HEADER_MAGIC);
            catEntry.putShort(VERSION_CODE);
            catEntry.putShort(MIN_VERSION);
            catEntry.putShort((short)0);
            catEntry.putShort(DEFLATE_METHOD);
            long catStart = archive.getFilePointer();
            for(java.util.Iterator it = catalog.iterator(); it.hasNext();) {
                ((Entry)it.next()).writeCatalog(catEntry);
            catEntry.position(0);
            catEntry.putInt(CATALOG_END_MAGIC);
            catEntry.putShort(DISC_NUMBER);
            catEntry.putShort(DISC_NUMBER);
            catEntry.putShort((short)catalog.size());
            catEntry.putShort((short)catalog.size());
            catEntry.putInt((int)(archive.getFilePointer() - catStart));
            catEntry.putInt((int)catStart);
            catEntry.putShort((short)0);
            archive.write(catEntry.array(), 0, catEntry.position());
            archive.setLength(archive.getFilePointer());  // truncate if old file
            archive.close();
            def.end();
         * Closes entry in progress.
        public void flush() throws IOException{
            if(entryInProgress == null)
                throw new IllegalStateException("Must call openEntry before writing");
            entryInProgress.close();
            entryInProgress = null;
         * Standard write routine. Defined by {@link java.io.OutputStream}.
         * Can only be used once openEntry has defined the file.
         * @param b  Bytes to write
        public void write(byte[] b) throws IOException{
            if(entryInProgress == null)
                throw new IllegalStateException("Must call openEntry before writing");
            crcAcc.update(b);
            def.setInput(b);
            while(!def.needsInput())
                deflate();
         * Standard write routine. Defined by {@link java.io.OutputStream}.
         * Can only be used once openEntry has defined the file.
         * @param b  Bytes to write
        public void write(int b) throws IOException{
            oneByte[0] = (byte)b;
            crcAcc.update(b);
            write(oneByte, 0, 1);
         *  Standard write routine. Defined by {@link java.io.OutputStream}.
         * Can only be used once openEntry has defined the file.
         * @param b  Bytes to write
         * @param off Start offset
         * @param len Byte count
        public void write(byte[] b, int off, int len) throws IOException{
            if(entryInProgress == null)
                throw new IllegalStateException("Must call openEntry before writing");
            crcAcc.update(b, off, len);
            def.setInput(b, off, len);
            while(!def.needsInput())
                deflate();
        * Gets a buffer full of coded data from the deflater and writes it to archive.
        private void deflate() throws IOException {
            int len = def.deflate(deflateBuf);
            totalCompressed += len;
            if(len > 0)
                archive.write(deflateBuf, 0, len);

Maybe you are looking for

  • XML 5.6.1 Running Total

    Hi I am new this XML Publisher. We are working on using BPA/XML Publisher to print the AR Invoice. I have two questions 1. How to print the values of subtotal, tax and Invoice Total in only last page 2. How to print the Running total of extend amount

  • Dynamic Attributes with UDF - NullPointerException

    Hello, I want to set the file name of an file receiver by means of setting dynamic attributes in an UDF. I use the following code and map the output to the root node of the target message (one input variable is var1) DynamicConfiguration conf = (Dyna

  • JSF 1.2 with SERVLET 2.3

    Hi, i've download the latest JSF 1.2 RI but i can't see any page as i get the following error: ava.lang.NoSuchMethodError: javax.servlet.http.HttpServletResponse.getContentType()Ljava/lang/String; at com.sun.faces.context.ExternalContextImpl.getRespo

  • Settings in .PRM file not working

    Hi All, i'm using XI 3.1 with FP1.3 I want to change some settings in .PRM file (change operator 'like' to 'matches'). I do it in sqlsrv.prm which is located in BO-PATH\BusinessObjects Enterprise 12.0\win32_x86\dataAccess\connectionServer\odbc\ -> Th

  • AE CS4 constant crashing...error windows bombarding me...

    Hey Fellas! Anyone know what this means (see attached)? It hits me over and over everytime I close it another one opens...then I get a hard crash or sometimes I will get a "crach invoked by Advanced 3D Renderer". It is a 1280 x 720 / 16 Bit / 59.94 /