Search code examples
javaflat-filebean-io

How to configure beanio to ignore certain chars in a flat file


I am currently working on a legacy application that gets its data via flat files. To read and write flat files beanio is used and the records are defined via annotations. My Problem is that the specification of one of the flat files demands that from index 20 to 26(not the end of the record) blanks are used to reserve space for future purposes.

How can I tell Beanio via annotations that at these positions are blanks it has to ignore?


Solution

  • Have you tried to define a @Field of length 7 to consume these spaces?

    @Field(at = 20, length = 7, lazy = true, trim = true)
    private String spaces;
    

    The lazy=true and trim=true parts should make this field/property be null at all times.