Archive for the ‘CSV’ Category

Nightly Builds

Wednesday, February 2nd, 2011

To all of you who don’t want to wait for the next releases of any of my projects there are good news. I introduced Nightly Builds now which are linked on individual project’s pages. In case you detect any missing build, just send me a message via the contact page.

CSV/Excel Utility Package V2.1 released

Monday, January 10th, 2011

I finished this release some months ago but didn’t find time yet to finally release it. Version 2.1 introduces some new features and classes that ease handling of table-like data from different sources:

  • New TableReader implementations for JDBC, XML, JTable
  • New TableWriter implementations for HTML and XML
  • Introduction of type conversion to allow object-string conversion and vice versa while reading and writing tables
  • New Reader and Writer wrappers that read and write JavaBeans.
  • New Filter implementations for TableReader that remove rows and columns.
  • Some abstract classes were separated into general base classes and stream-handling classes. This allows easier development of non-stream based implementations.

You can download the new version here or visit the Homepage of the utility where you will find some examples on how to use it.

CSV/Excel Utility Package V2.0.2 released

Wednesday, September 22nd, 2010

The package has undergone some minor bugfixing andJUnit Test was introduced for CSV files. Thanks to eldn for his help making this release.

You can download it here or visit the Homepage of the utility where you will find some examples on how to use it.

CSV/Excel Utility Package V2.0.1 released

Tuesday, June 15th, 2010

It took me quite some time to upgrade this package to the next level and support Excel. It propably still has some flaws. However, I use it now for some months in production and fixed the most critical bugs. In fact, it seems to run quite stable now.

Please note that upgrading from previous version will require you to update your package imports.

You can download it here or visit the Homepage of the utility where you will find some examples on how to use it.

CSV Utility Package 2.0 Beta

Thursday, November 26th, 2009

Some work has been spent over the last weeks to upgrade the stable CSV Utility Package. Of course, the new version contains all the useful existing functionality. The most beneficial improvement is the introduction of ExcelReader and ExcelWriter classes that behave like the CSV pendants. This means that you do not have to care about the underlying output format when you want to read or write table-structured data. The most important changes are:

  • Introduction of a TableReader and TableWriter interface
  • Introduction of Excel implementation
  • Aligning CSV and Excel implementations to these interfaces
  • Introduction of a Factory class in order to select correct implementation (CSV or Excel)

The Beta version still requires some work in terms of documentation and code beautifying. However, the CSV part is already frozen and you can use it to upgrade your existing projects to the new utility version. The Excel part still faces some changes while improving usability.

Please be aware also that Java package structure needed to be changed to integrate the new classes and interfaces. Additionally, new 3rd party libraries were integrated (Apache POI and JavaBeans Activation).

Download the Beta Version or browse the existing API Documentation. Bugs and/or enhancements can be requested via Bugzilla.

CSV Utility Package V1.0.2 released

Tuesday, October 20th, 2009

I made some fixes and enhancements to the CSV Utility Package:

  • Bug #9: Spaces before and after a value are treated correctly now
  • Enhancement #10: CSVReader forwards comment lines to callback objects
  • Enhancement #11: A test script was integrated to check major features
  • New Class: CSVUtils offers methods for copying JDBC results and JTable data to CSVWriters

You can download the latest release here.

CSV Utility Package V1.0.1 released

Monday, September 28th, 2009

A new update of my CSV Utility Package was released. It contains some fixes and enhancements:

  • Build system creates tar archive
  • Fixed Bug #2: NullPointerException in CSVReader class
  • Fixed Bug #4: Multiline values fail when a line looks like a comment
  • Enhancement #7: Excel Fix: first column of first row must not start with “ID”
  • Enhancement #8: Add row and column count

You can download the latest release here.

CSV Utility Package Released

Saturday, August 16th, 2008

I decided recently to publish my very simple utility classes for reading and writing CSV files. The main project page is now available. The package, published under the GNU Lesser General Public License, allows you to easily integrate CSV functionality into your application. The utilities can be configured to use different column delimiter and separator characters in case you need to adopt some other versions of CSV. The default configuration conforms to the Excel style of CSV.

Since this CSV package uses streams, you are able to read from any stream. And, of course, you can write to any stream. You could even synchronize in your application by applying the reader/writer synchronization described in one of my artices.

You can download the latest stable release at the main project page.

Here is a short example on reading a CSV file using the CSVReader class:

java.io.File f = new java.io.File("csv-test.csv");
csv.CSVReader in = new csv.CSVReader(new java.io.FileReader(f));
while (in.hasNext()) {
    String columns[] = in.next();
    // Do something here
}
in.close();

Please note that the CSVReader class actually implements the Iterator interface.

Writing a CSV file is even easier. Just create an instance of the CSVWriter class and pass it your rows:

java.io.File f = new java.io.File("csv-test.csv");
CSVWriter out = new CSVWriter(new java.io.FileWriter(f));
out.printRow(new String[] { "0:0", "0:1", "0:2" });
out.printRow(new String[] { "1:0", "1:1", "1:2" });
out.close();

Documentation

The API documentation tells you all details and configuration parameters that you can use to control the behaviour of the reader and writer classes.