BeanIO parsing - combination of fixed length and delimitator(new line)

3.2k views Asked by At

Example of file:

FIRSTSECONDTHIRD  
firstsecondthird
12345^$%$#@abcde

I have a Pojo like this:

class Pojo{
   String firstAttribute;
   String secondAttribute;
   String thirdAttribute;
}

bean xml configuration:

<stream name="attributes" format="fixedlength"  >


    <record name="myrecord" class="Pojo" minOccurs="0" maxOccurs="unbounded" minLength="16" maxLength="16"  >

        <field name="firstAttribute" length="5" trim="true" />
        <field name="secondAttribute" length="6" trim="true"/>
        <field name="thirdAttribute"  length="5" trim="true"/>

    </record>

</stream>

My problem:

I need a way to use "\n" delimiter in combination with fixed length.

So I need a result of 3 objects (one from each line)

I tried with

        <parser>
            <property name="recordTerminator" value="\n\r" />
        </parser>

but i receive: java.lang.IllegalArgumentException: Record terminator must be a single character

0

There are 0 answers