[ 
https://issues.apache.org/jira/browse/COMPRESS-428?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16245327#comment-16245327
 ] 

Stefan Bodewig commented on COMPRESS-428:
-----------------------------------------

In most cases you don't know the compressed size upfront. In order to implement 
this functionality you'd have to compress the entry's data and keep in memory 
(or a temporary file) together with the original data (also in memory or a 
temporary file). The "in memory" part means you'd keep more than twice the size 
of the original data there, something the docs should better state clearly.

> Adding option to auto-select final method(DEFLATED or STORED) for 
> ZipArchiveOutputStream
> ----------------------------------------------------------------------------------------
>
>                 Key: COMPRESS-428
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-428
>             Project: Commons Compress
>          Issue Type: Improvement
>          Components: Compressors
>    Affects Versions: 1.13
>         Environment: commons-compress 1.13
>            Reporter: Fuwei Chin
>            Priority: Minor
>              Labels: compress, deflated, stored
>             Fix For: 1.16
>
>
> Before writing "deflated" data to output stream, check if the compressed size 
> of a zip archive entry is bigger than or equal to its original size, if so 
> then use method "stored" instead, just like what 7-Zip does when creating a  
> zip file.
> The optimization above can be done by 
>   1. adding a new option "DEFLATED_IF_NECESSARY" for 
> ZipArchiveOutputStream#method.
>   2. auto-selecting final method(DEFLATED or STORED) if DEFLATED_IF_NECESSARY 
> specified.



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to