Could anyone explain me a simple way to create a fixed lenght file? I want to query a DB and then put the results in fixed lenght file... i guess flatpack brings me FixedLenghtWriter.
thanks a lot!
Mario.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello,
Following this trivial example… Do you know how can I get a Map from the PEOPLE xml mapping? This map will be used to create FixedWriterFactory factory = new FixedWriterFactory(mapping));
I'm think that the following is an aproach… but i'm not sure about the second argument of the FixedLengthParser constructor:
{
FileReader fr = null;
final File xmlFile = new File(mapping);
fr = new FileReader(xmlFile);
FixedLengthParser flp = new FixedLengthParser(fr, new FileReader(data));
Map<String,String> mp = MapParser.parse(fr,flp);
System.out.println(mp.toString());
}
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hello!
Could anyone explain me a simple way to create a fixed lenght file? I want to query a DB and then put the results in fixed lenght file... i guess flatpack brings me FixedLenghtWriter.
thanks a lot!
Mario.
here is a trivial extract based on the PEOPLE xml mapping
FixedWriterFactory factory = new FixedWriterFactory(mapping));
Writer writer = factory.createWriter(new FileWriter(newFile));
writer.addRecordEntry("LASTNAME", "DOE");
writer.addRecordEntry("ADDRESS", "1234 CIRCLE CT");
writer.addRecordEntry("STATE", "OH");
writer.addRecordEntry("ZIP", "44035");
writer.addRecordEntry("FIRSTNAME", "JOHN");
writer.addRecordEntry("CITY", "ELYRIA");
writer.nextRecord();
writer.flush();
E.
Thanks Eric.
Hello,
Following this trivial example… Do you know how can I get a Map from the PEOPLE xml mapping? This map will be used to create FixedWriterFactory factory = new FixedWriterFactory(mapping));
I'm think that the following is an aproach… but i'm not sure about the second argument of the FixedLengthParser constructor: