You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by sushil_vsk5 <su...@yahoo.co.in> on 2012/07/25 08:35:28 UTC

Splitting large binary file into chunks

Hello:
Is it possible to use the camel splitter in a streaming mode to split a
large binary file (for example an Mp4 file) into fixed sized chunks? Or does
the file always have to be text based?
Regards,
Sushil



--
View this message in context: http://camel.465427.n5.nabble.com/Splitting-large-binary-file-into-chunks-tp5716434.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Splitting large binary file into chunks

Posted by Christian Müller <ch...@gmail.com>.
Checkout http://camel.apache.org/splitter.html
I'm not sure whether ".streaming()" has any effect, if you provide your own
splitter bean...
Your custom splitter bean (the Iterator) could receive the file handle and
use a FileInputStream to read the file content in chunks. For each next()
method call on your Iterator reads one chunk.

Best,
Christian

On Wed, Jul 25, 2012 at 8:35 AM, sushil_vsk5 <su...@yahoo.co.in>wrote:

> Hello:
> Is it possible to use the camel splitter in a streaming mode to split a
> large binary file (for example an Mp4 file) into fixed sized chunks? Or
> does
> the file always have to be text based?
> Regards,
> Sushil
>
>
>
> --
> View this message in context:
> http://camel.465427.n5.nabble.com/Splitting-large-binary-file-into-chunks-tp5716434.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
>

Re: Splitting large binary file into chunks

Posted by Willem Jiang <wi...@gmail.com>.
You use define a customer IteratorFactory to return Iterators for
Splitter to use.

import static org.apache.camel.builder.ExpressionBuilder.beanExpression;
from("direct:streaming")
     .split(beanExpression(new MyCustomIteratorFactory(),  "iterator"))
     .streaming().to("activemq:my.parts")

Willem

On Wed, Jul 25, 2012 at 2:35 PM, sushil_vsk5 <su...@yahoo.co.in> wrote:
>
> Hello:
> Is it possible to use the camel splitter in a streaming mode to split a
> large binary file (for example an Mp4 file) into fixed sized chunks? Or does
> the file always have to be text based?
> Regards,
> Sushil
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Splitting-large-binary-file-into-chunks-tp5716434.html
> Sent from the Camel - Users mailing list archive at Nabble.com.