1

文件示例:

FIRSTSECONDTHIRD  
firstsecondthird
12345^$%$#@abcde

我有一个像这样的Pojo:

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

bean xml配置:

<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>

我的问题:

我需要一种将“\n”分隔符与固定长度结合使用的方法。

所以我需要 3 个对象的结果(每行一个)

我试过了

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

但我收到:java.lang.IllegalArgumentException:记录终止符必须是单个字符

4

0 回答 0