Announcement Announcement Module
Collapse
No announcement yet.
FlatFileReader Trimming spaces Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • FlatFileReader Trimming spaces

    Hello All,

    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" />
    </bean>

    If following are the values:
    abc y
    de
    xy

    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.

  • #2
    It's in the FieldSet that the String is getting trimmed. You can use FieldSet#readRawString() to avoid this.

    Comment


    • #3
      Thanks Lucas! I will try that!

      Comment

      Working...
      X