Question

Is there any framework/library to help writing fixed length flat files in java?

I want 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 Flatfile

Jaya       123 0032120110505
Prathiksha5000 0122120110504
Prabha       1 0000120101231
...

Smooks Fixed length using this i can able to read the file as POJO, List or Map.

The issue is i am unable to find any process to write POJO to FixedLenthFile.

Also kindly suggest is there any other way to process the FixedLengthFlatFIle using camel,spring Project.

Currently in our project we are using smooks, camel, spring for EDI to POJO and POJO to EDI. Now we have to add features for FixedLengthFlatFile Processing.

Was it helpful?

Solution

I found the answer.

WRT link

bindy or beanio which can work with flat files

Camel Bindy

Camel 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).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top