commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Emmanuel Bourg <ebo...@apache.org>
Subject Re: [csv] Why does CSVFormat provide a validate() method instead of validating parameters passed to its constructor?
Date Wed, 14 Mar 2012 22:54:46 GMT
Le 14/03/2012 23:35, sebb a écrit :

> It's not too late to change to using Character.

The issue is the parser, this will probably degrade the performance. 
Unless the fields are made package private and accessed directly by the 
parser.


> It's not possible currently to create a format with encapsulator,
> commentStart and escape all null, except by knowing the value of
> DISABLED.

The solution might be to introduce a quoting mode to the format. I 
planned to add this for the printer, but it can be useful for the parser 
too. This mode would have 3 states:
- NEVER: Don't use quotes, even if the encapsulator is defined
- ALWAYS: Always enclose values into quotes
- REQUIRED: Enclose the values only if necessary

Thus the quotes could be disabled with:

CSVFormat.DEFAULT.withEncapsulation(NEVER)


> Likewise, encapsulator and escape are not mutually exclusive.
> Should they be?

I wish it was, but MySQL actually produces files with quotes and escaped 
characters (delimiter and line feeds). I'm reviewing other RDBMS to see 
what formats we can expect in the wild.

Emmanuel Bourg



Mime
View raw message