Wednesday, 4 February 2015

Extracting data from text files using Java

I use Java a fair amount to look at data contained within text files. It can be data from surveys, logs of various processes and sometimes extracts from databases.

This post links to four articles on how to read data line by line from a simple text file. The four articles are all very similar but detail different methods of accessing the data. They all consist of five steps:
  • Defining the file
  • Opening the file
  • Reading in the data
  • Doing something with the data
  • Outputting the result
The articles are:
  1. Extract data from a simple text file
  2. Extract data from gzipped text files - useful if the individual files are large. The biggest bottleneck is disc access times, especially HDDs.
  3. Extract data from zipped text files (zip archives)
  4. Extract data from a directory of text files - it's often the case that you want to analyse data from a whole raft of files.
Hopefully they will be of use.

No comments:

Post a Comment