Results 1 to 3 of 3

Thread: FlatFileReader Trimming spaces

Hybrid View

  1. #1
    Join Date
    Apr 2008
    Posts
    174

    Default 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. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

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

  3. #3
    Join Date
    Apr 2008
    Posts
    174

    Default

    Thanks Lucas! I will try that!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •