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

michael elbaz edited comment on CAMEL-13774 at 8/7/19 11:43 AM:
----------------------------------------------------------------

Maybe instead we can just improve this class 
https://github.com/apache/camel/blob/master/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java

And instead of just write and close the stream all the time 
{code:java}
try {
    IOHelper.copy(is, zos);
} finally {
    IOHelper.close(is, zos);
}
{code}
we can simply detect if it's java 8 stream then convert it to iterator and then 
just iterate over it what do you think about ?


was (Author: michael992):
Maybe instead we can just improve this class 
https://github.com/apache/camel/blob/master/components/camel-zipfile/src/main/java/org/apache/camel/dataformat/zipfile/ZipFileDataFormat.java

And instead of just write and close the stream all the time 
{code:java}
try {
    IOHelper.copy(is, zos);
} finally {
    IOHelper.close(is, zos);
}
{code}
we can simply detect if it's java 8 stream convert to iterator and the iterate 
over it what do you think about ?

> camel-zipfile - Accept an iterator as body for zip
> --------------------------------------------------
>
>                 Key: CAMEL-13774
>                 URL: https://issues.apache.org/jira/browse/CAMEL-13774
>             Project: Camel
>          Issue Type: Improvement
>          Components: camel-zipfile
>    Affects Versions: 2.24.1, 3.0.0.M4
>            Reporter: michael elbaz
>            Assignee: Claus Ibsen
>            Priority: Major
>             Fix For: 3.0.0, 3.0.0.M5
>
>
> Accept iterator or Java 8 Stream as body to produce a zip file this will 
> avoid to use the memory for big file (for some use case we can't get an 
> inputStream)
> For example it would be very nice to be able to do this:
> {code:java}
> from("timer:foo?repeatCount=1")
>                 .setBody(constant(Stream.of("v1", "v2")))
>                 .setHeader(Exchange.FILE_NAME, constant("report.txt"))
>                 .marshal().zipFile()
>                 .to("file:output/directory");
> {code}
> (https://stackoverflow.com/questions/50295432/zip-and-unzip-a-large-file-without-loading-the-entire-file-in-memory-in-apache-c)



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to