Jan 9th, 2008, 08:03 AM
FlatFileOutputSource cast exception on primitives write
I'm trying to write a byte array to a flat file using the FlatFileOutputSource.
In the convertAndWrite function, I'm getting a class cast exception on the following line:
Object array = (Object) data;
(data is of type byte)
Is this the desired functionality or am I off base?
Also, trying to write this out as a continuous stream, with no line breaks. Should I be using the FlatFileOutputSource, extend it or roll my own?
Jan 9th, 2008, 11:18 AM
Just for clarification, what exactly are you trying to write out? I was a bit confused reading it...also, I'm assuming you're using Java 5?
Jan 9th, 2008, 11:46 AM
Trying to read and write ISO 8583-1993 files - Financial Transactions specification (IPM clearing file).
The file format is a stream of data, with no line breaks, where each record is defined by a length indicator, transaction type, bitmap address and data fields as defined by the bitmap address.
Yes Java 5, spring batch m2.
Last edited by gjones; Jan 9th, 2008 at 11:49 AM.
Jan 9th, 2008, 03:12 PM
I think you're on the wrong track. FlatFileItemWriter (the new name) is for text files (writing Strings with new lines). You probably need to write your own ItemWriter (aka OutputSource) that handles your byte data in the way you need.