General

Can fixedformat4j help me parse large text files?

As the API is now it can't. But on the other hand it doesn't constrain you in anyway either.

Fixedformat4j currently concentrate on mapping one single line to a java object. You are free to loop through any large text file and use the fixedformatmanager to create instances of java objects.

I am thinking on how to integrate some help for doing this, without putting any constrains on how the API is used.


I would like to map my own object. Can I apply my own custom formatter to do this?

Yes.

To map your domain object you should create a custum formatter instance implementing the FixedFormatter interface.

Your custom formatter will have access to all the different annotation data through a FormatInstructions instance. Your formatter receives this isntance when the parse and format methods of your formatter is called by the FixedFormatManager.

Ex. if you would like to access the value given to the FixedFormatPattern annotation you do this through the formatInstruction.getFixedFormatPatternData().getPattern()

To instruct the manager to use you custom formatter, you set the formatter attribute of the field annotation:

@Field(offset = 1, length = 10, formatter = CustomFormatter.class)