Java Data File Read/Write Utility

datafile.jar is a Java data file read/write utility that provides a convenient set of interfaces for reading and writing data to and from files in widely accepted format such as comma separated values (CSV), fixed width, tab separated, as well as others.


   Creating a reader for CSV file using

DataFile read =

read.setDataFormat(new CSVFormat());
// first line is column header

try { File("/data/test.csv"));

  for (DataRow row =;
       row != null;
       row = {

    String text = row.getString(0);
    // retrieval using column header
    int number1 = row.getInt("FIRST_NUMBER", 0);
    double number2 = row.getDouble(2);

    // use the retrieved data ...


finally {

   Creating a writer for data file with
   European encoding ISO-8859-2 (European)
   using tab separated format.
   (rewrite existing file)

DataFile write =
  DataFile.createWriter("8859_2", false);

write.setDataFormat(new TabFormat());

try { File("/data/test.txt"));

  for (DataRow row =;
       row != null;
       row = {

    row.add("some German text");


finally {

Release Notes

2004.04.24 SATURDAY
+ Released source code via SourceForge
  under GNU Library or Lesser General Public License (LGPL).
+ Added unit test for CSV, tab delimited, and fixed width
  data formats.

2004.01.30 FRIDAY
+ Added few more retrieval interfaces for DataRow.
+ Added "getHeaderNames()" to DataFile.

2003.09.08 MONDAY
+ Bug Fix: CSV encoding omitted starting quote
  (Thanks to Phil Duhs for reporting this problem)
+ removed debugging code from DataFile

2003.07.23 WEDNESDAY
+ Bug Fix: DataRow no longer throws IndexOutofBoundsException
  when accessing trailing empty items.
  (Thanks, Dennis Buijs, for reporting the bug)

2003.04.29 TUESDAY
+ Bug Fix: CSV Format now handles new line character within
  the CSV encoded data cell.
+ Added header support (first row of the data file is header)
+ Added data retrieval using column name Logo

Copyright © 2004 Infomata.