Univocity-parsers FixedWidth parsing with multiple records per line

347 Views Asked by At

I am trying to use the univocity-parsers to parse a fixed-width formatted file that includes a variable number of fixed-width records per line.

Format is record id [6], # of sub-records [3], sub-record [6]

Rec1..3..A1B1C1A2B2C2A3B3C3
Rec2..2..A1B1C1A2B2C2

The desired result is to have an array of sub-records. The @Linked annotation appears to apply but the documentation states this only available for the HTML parser.

My current solution is to parse the sub-records as a string, then loop through each record and insert newlines into the sub-record string and re-parse. Is there a way to accomplish this using univocity-parser?

Thanks in advance.

1

There are 1 best solutions below

0
On BEST ANSWER

Author of the library here. This is not supported, you'll have to split these sub-records manually.