Apr 30th, 2008, 04:47 PM
FlatFileReader Trimming spaces
I am using FlatFileReader with the FixedLengthTokenizer, in which I am mapping names to columns:
<bean id="fileDescriptor" class="org.springframework.batch.item.file.transfo rm.FixedLengthTokenizer">
<property name="names" value="field1" />
<property name="columns" value="1-5" />
If following are the values:
Then I would expect the reader to return me "abc y", " de ", "xy " i.e. I would expect it to retain the spaces as I had clearly mentioned that I need 1 through 5 characters.
I looked at FixedLengthTokenizer source code, it does not seem to trimming it, but I am loosing my spaces in the second and third values, i.e. I am getting "de" and "xy" back.
Apr 30th, 2008, 05:43 PM
It's in the FieldSet that the String is getting trimmed. You can use FieldSet#readRawString() to avoid this.
Apr 30th, 2008, 08:28 PM
Thanks Lucas! I will try that!