I'd probably create a lexer (using JFlex), because these little custom file formats have a tendency to become more complex over time, which makes a hand-coded parser harder and more error-prone to maintain.
Well, Ulf's advice still seems pretty good. But regexes would work too. I think it's too early to worry about imaginary performace problems here - try it and see. Chances are good that the time it takes to read the file will be greater than the time necessary to parse it.
[amit]: ...given that my file size would not exceed say 100 lines. However, the bulk of the input files would be quite enormous.
That didn't really make sense to me. Are you saying that 100 lines is enormous? Are some of the lines extremely long? Are there many, many files? Or something else?
"I'm not back." - Bill Harding, Twister
Joined: Apr 01, 2005
By that line I meant that the number of such files would be large. About a certain thousand can be safely asssumed for now. The bulk is sure to go up in future.