You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by suresh_camel <su...@gmail.com> on 2013/11/15 05:27:52 UTC
Is there an smart way to write a fixed length flat file?
I need to write a collection of beans/entities into a flat file without
worrying with convertions, padding, alignment, fillers, etcs
For example, I'd like to parse a bean like:
public class Entity{
String name = "name"; // length = 10; align left; fill with spaces
Integer id = 123; // length = 5; align left; fill with spaces
Integer serial = 321 // length = 5; align to right; fill with '0'
Date register = new Date();// length = 8; convert to yyyyMMdd
}
... into ...
name 123 0032120110505
mikhas 5000 0122120110504
superuser 1 0000120101231
...
Smooks Fixed Length
<http://www.smooks.org/mediawiki/index.php?title=V1.5:Smooks_v1.5_User_Guide#Fixed_Length_Values>
I can do the read with "FixedLengthReaderConfigurator" class but i am unable
to find any write process.
--
View this message in context: http://camel.465427.n5.nabble.com/Is-there-an-smart-way-to-write-a-fixed-length-flat-file-tp5743323.html
Sent from the Camel - Users mailing list archive at Nabble.com.
Re: Is there an smart way to write a fixed length flat file?
Posted by Claus Ibsen <cl...@gmail.com>.
You can take a look at
bindy or beanio which can work with flat files
http://camel.apache.org/bindy
http://camel.apache.org/beanio
Smooks doesn't work with Camel 2.10 onwards (AFAIR). There is a ticket
reported to the smooks team to fix that, but they haven't done it yet,
not released a new version of Smooks in a fairly long time. I would
try to avoid using Smooks, until the project comes back to life (if it
does).
On Fri, Nov 15, 2013 at 5:27 AM, suresh_camel <su...@gmail.com> wrote:
> I need to write a collection of beans/entities into a flat file without
> worrying with convertions, padding, alignment, fillers, etcs
>
> For example, I'd like to parse a bean like:
>
> public class Entity{
> String name = "name"; // length = 10; align left; fill with spaces
> Integer id = 123; // length = 5; align left; fill with spaces
> Integer serial = 321 // length = 5; align to right; fill with '0'
> Date register = new Date();// length = 8; convert to yyyyMMdd
> }
> ... into ...
>
> name 123 0032120110505
> mikhas 5000 0122120110504
> superuser 1 0000120101231
> ...
>
> Smooks Fixed Length
> <http://www.smooks.org/mediawiki/index.php?title=V1.5:Smooks_v1.5_User_Guide#Fixed_Length_Values>
>
> I can do the read with "FixedLengthReaderConfigurator" class but i am unable
> to find any write process.
>
>
>
> --
> View this message in context: http://camel.465427.n5.nabble.com/Is-there-an-smart-way-to-write-a-fixed-length-flat-file-tp5743323.html
> Sent from the Camel - Users mailing list archive at Nabble.com.
--
Claus Ibsen
-----------------
Red Hat, Inc.
Email: cibsen@redhat.com
Twitter: davsclaus
Blog: http://davsclaus.com
Author of Camel in Action: http://www.manning.com/ibsen