You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by "Will Pugh (JIRA)" <ji...@apache.org> on 2007/01/03 19:05:27 UTC

[jira] Created: (SANDBOX-183) Compress should allow for writing to Zip Files

Compress should allow for writing to Zip Files
----------------------------------------------

                 Key: SANDBOX-183
                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
             Project: Commons Sandbox
          Issue Type: New Feature
          Components: Compress
    Affects Versions: Nightly Builds
            Reporter: Will Pugh
             Fix For: Nightly Builds
         Attachments: myzip.zip

Compress should be able to modify existing ZipFiles.



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Mario Ivankovits (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462159 ] 

Mario Ivankovits commented on SANDBOX-183:
------------------------------------------

I haven't had the time to give it a try, but looks promising.

Just a few things in advance:

* use the org.apache.commons.compress package prefix (instead of the com.* one)
* add the ASF license header
* use method names with lower-case first letter
* did you already sent a CLA? [1]
* do not use e.printStrackTrace()

Then something technically
* ModifiableZipFile.WriteExistingEntries: when you "shift" the content you allocate a buffer with the full sizeOfBlock size, isn't it dangerous (out of memeory) when you have to deal with large zip files, or at least with a large compressed entry?

Thanks!
Mario

[1] http://www.apache.org/licenses/#clas

> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>             Fix For: Nightly Builds
>
>         Attachments: myzip.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Henri Yandell (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Henri Yandell updated SANDBOX-183:
----------------------------------

    Fix Version/s:     (was: Nightly Builds)

> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>         Attachments: myzip.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Mario Ivankovits (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462205 ] 

Mario Ivankovits commented on SANDBOX-183:
------------------------------------------

> wouldn't it be easier just to expand the zipfile in an temp directory

Yea, I am a little bit "conservative" about this topic too.
How can we know that we do not damage a zip in any case, though, the algorithmic used currently seems not that complicated - I don't know.

We should give it  a try, maybe.

Instead of incorporating it into the existing codebase, can't we add it as alternative implementation? Something like ZipEx method.
So that we can have both methods (direct alteration and unzip/zip through temp dir).

> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>             Fix For: Nightly Builds
>
>         Attachments: myzip.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Christian Grobmeier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462198 ] 

Christian Grobmeier commented on SANDBOX-183:
---------------------------------------------

Hi,
it seems difficult to integrate this in the existing codebase. It looks like we would have to throw away the old zip implementation and use this one, if we want this feature. Please help if i am wrong.

For the memory problem: wouldn't it be easier just to expand the zipfile in an temp directory, take the intrnal catalog to see what files we need again and rebuild the whole stuff? I think this is the way winzip handles this. This would be quite safe and the old file would't get corrupt in case of any trouble. This strategy would also allow us to delete from the zip package. No?

Cheers,
Chris.

> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>             Fix For: Nightly Builds
>
>         Attachments: myzip.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Will Pugh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Pugh updated SANDBOX-183:
------------------------------

    Attachment: myzip2.zip

Fixed most of Mario's style concerns.

Did not address the memory issue yet.

> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>         Attachments: myzip.zip, myzip2.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Will Pugh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Pugh updated SANDBOX-183:
------------------------------

    Attachment: myzip.zip

> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>             Fix For: Nightly Builds
>
>         Attachments: myzip.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Christian Grobmeier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462206 ] 

Christian Grobmeier commented on SANDBOX-183:
---------------------------------------------

Adding it as altnerate would be possible. Archivers are registered at the beginning of "ArchiverFactory". There we could add this implementation. Lets name it "ZipQuick" cause it may be more quick but a bit unsure? The new stuff must implement the archiver-interfaces when integrating it (all in org.apache.commons.compress)

> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>             Fix For: Nightly Builds
>
>         Attachments: myzip.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Commented: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Christian Grobmeier (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12462210 ] 

Christian Grobmeier commented on SANDBOX-183:
---------------------------------------------

another thing: this newimplementation does depend on commons IO. I am not sure, but i think there was a discussion in the past that this is not a good idea. This "copy" method used is also somewhere in the compress code when i remember correct. I think its CompressUtils or something like that.

Btw, you can add this implemetnation at runtime via the static addArchiver() method in the factory. May be helpful...

And. for delete/modification support the Archiver-interfaces must be extended with such methods too- no big deal. Idea was: 

- get an list of ArchiveEntrys with: list() or entries()
- do: delete(ArchiveEntry entry) for each entry you dont want any longer
- do. update() to rewrite your zip file


> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>             Fix For: Nightly Builds
>
>         Attachments: myzip.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: https://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


[jira] Updated: (SANDBOX-183) Compress should allow for writing to Zip Files

Posted by "Will Pugh (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/SANDBOX-183?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Will Pugh updated SANDBOX-183:
------------------------------


I fixed the style concerns, but did not fix the allocation size issue yet.  Should not be hard to do, and it should be done.

I'm not sure how you plan to modify a zip file, whether you do it the "temp file" way or the "change in place" way, where a process crash would not create a corrupted version of the file.

Traditionally, you would do this by creating a temporary zip file, and doing a "mv" on it, so the name changed to the new name, but no data needed to be moved.  I'm not sure you can do this in Java, unless you had planned on shelling out the OS (and detecting different OSes to do this).

There were two main reasons I wanted to do this in memory:

  1)  So you would not need any type of temp directory
  2)  The performance differences can be VAST in some cases.  Imagine dealing with large XML or text files, or anything where the compression is significant.  If you do the temp file approach, you need to uncompress everything, and write it to a file.  Then, re-open all those files and re-compress them.  This is not only a lot more CPU time in compressing and uncompressing, but also a lot more data-movement using the disk drive.


> Compress should allow for writing to Zip Files
> ----------------------------------------------
>
>                 Key: SANDBOX-183
>                 URL: https://issues.apache.org/jira/browse/SANDBOX-183
>             Project: Commons Sandbox
>          Issue Type: New Feature
>          Components: Compress
>    Affects Versions: Nightly Builds
>            Reporter: Will Pugh
>         Attachments: myzip.zip, myzip2.zip
>
>
> Compress should be able to modify existing ZipFiles.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org