I am interested in parsing a fairly large text file in Java (1.6.x) and wondering what approach would be considered best practice?
The file is likely to be about 1 MB in size and will consist of thousands of records per line:
Entry { property1=value1 property2=value2 ... }
and etc.
My first instinct is to use regular expressions, but I have no experience using Java in a production environment, and therefore I'm not sure how powerful the java.util.regex classes are.
To clarify a bit, my application will be a web application (JSP) that parses a given file and displays the various values โโit retrieves. There is only one file that receives parsing (it is located in a third-party directory on the host).
The application will have a rather low use (maybe only a few users use it a couple of times a day), but it is very important that information is extracted as quickly as possible when using them.
In addition, are there any precautions for loading a file into memory each time it is analyzed?
Can someone recommend an approach to take here?
thanks
java regex parsing
Christopher McAtackney
source share