You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by muerciak <mu...@gmail.com> on 2015/07/20 11:32:21 UTC

Large file with one line to cut by number of bytes

Hello All,

In my case I have large text file with only one line and I have to cut this
line by number of bytes (6155).
How to do it in Camel?

e.g. java code 

 int SIZE = 6155;

byte[] buff;
                
                byte[] buff;
                try (BufferedInputStream inputStream = new
BufferedInputStream(new java.io.FileInputStream(new File("file")))) {
                    buff = new byte[SIZE];
                    while (inputStream.read(buff, 0, SIZE) == SIZE) {
                        String line = new String(buff);
//next action...
                    }
                }


Thank you for any hint.



--
View this message in context: http://camel.465427.n5.nabble.com/Large-file-with-one-line-to-cut-by-number-of-bytes-tp5769551.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Re: Large file with one line to cut by number of bytes

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Its not really a Camel question. You write some java code to read the
bytes you need.

You may use a message translator EIP in a route that call a java bean
/ camel processor where you read those bytes


On Mon, Jul 20, 2015 at 11:32 AM, muerciak <mu...@gmail.com> wrote:
> Hello All,
>
> In my case I have large text file with only one line and I have to cut this
> line by number of bytes (6155).
> How to do it in Camel?
>
> e.g. java code
>
>  int SIZE = 6155;
>
> byte[] buff;
>
>                 byte[] buff;
>                 try (BufferedInputStream inputStream = new
> BufferedInputStream(new java.io.FileInputStream(new File("file")))) {
>                     buff = new byte[SIZE];
>                     while (inputStream.read(buff, 0, SIZE) == SIZE) {
>                         String line = new String(buff);
> //next action...
>                     }
>                 }
>
>
> Thank you for any hint.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Large-file-with-one-line-to-cut-by-number-of-bytes-tp5769551.html
> Sent from the Camel - Users mailing list archive at Nabble.com.



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2nd edition: http://www.manning.com/ibsen2