You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by sebb <se...@gmail.com> on 2013/04/17 13:02:25 UTC

[CSV] CSVPrinter#println() - should this be renamed?

CSVPrinter#println() actually prints the record separator, not a new line.

So perhaps it should be renamed?

Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by sebb <se...@gmail.com>.
On 17 April 2013 16:24, Emmanuel Bourg <eb...@apache.org> wrote:

> Le 17/04/2013 16:54, sebb a écrit :
>
> > Why not? For example double line might be useful.
>
> Why would you want to do that?
>
>
I have seen formats where the fields are printed one per line, and records
separated by a blank line.

It may be difficult to parse that, but it might still be useful to be able
to generate output in that format, especially if some field values are
quite long.


> > I don't see any such check.
>
> I got confused by the line break check on the delimiter. The line
> separator should be validated then.
>
>
> Emmanuel Bourg
>
>
>

Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 17/04/2013 16:54, sebb a écrit :

> Why not? For example double line might be useful.

Why would you want to do that?


> I don't see any such check.

I got confused by the line break check on the delimiter. The line
separator should be validated then.


Emmanuel Bourg



Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by sebb <se...@gmail.com>.
On 17 April 2013 15:12, Emmanuel Bourg <sm...@magelo.com> wrote:

> Le 17/04/2013 15:58, Gary Gregory a écrit :
>
> > Ok, so we could beef up
> > org.apache.commons.csv.CSVFormat.CSVFormatBuilder.validate()
> >
> > Could this be too restrictive? Could a user want a rec-sep /other/ than a
> > line-sep?
>
>
Why not? For example double line might be useful.


> It's already checked in the constructor.
>
>
I don't see any such check.


> Emmanuel Bourg
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
> For additional commands, e-mail: dev-help@commons.apache.org
>
>

Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by Emmanuel Bourg <sm...@magelo.com>.
Le 17/04/2013 15:58, Gary Gregory a écrit :

> Ok, so we could beef up
> org.apache.commons.csv.CSVFormat.CSVFormatBuilder.validate()
> 
> Could this be too restrictive? Could a user want a rec-sep /other/ than a
> line-sep?

It's already checked in the constructor.

Emmanuel Bourg


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by Gary Gregory <ga...@gmail.com>.
On Wed, Apr 17, 2013 at 8:44 AM, Emmanuel Bourg <eb...@apache.org> wrote:

> Le 17/04/2013 14:39, sebb a écrit :
>
> > Not necessarily.
> > It's a string, which can be anything.
>
> Anything but a line separator is an error. CSVFormat doesn't allow fancy
> values for the separator.
>

Ok, so we could beef up
org.apache.commons.csv.CSVFormat.CSVFormatBuilder.validate()

Could this be too restrictive? Could a user want a rec-sep /other/ than a
line-sep?

Gary


>
>
> Emmanuel Bourg
>
>
>


-- 
E-Mail: garydgregory@gmail.com | ggregory@apache.org
Java Persistence with Hibernate, Second Edition<http://www.manning.com/bauer3/>
JUnit in Action, Second Edition <http://www.manning.com/tahchiev/>
Spring Batch in Action <http://www.manning.com/templier/>
Blog: http://garygregory.wordpress.com
Home: http://garygregory.com/
Tweet! http://twitter.com/GaryGregory

Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 17/04/2013 14:39, sebb a écrit :

> Not necessarily.
> It's a string, which can be anything.

Anything but a line separator is an error. CSVFormat doesn't allow fancy
values for the separator.


Emmanuel Bourg



Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by sebb <se...@gmail.com>.
On 17 April 2013 12:30, Emmanuel Bourg <eb...@apache.org> wrote:

> Le 17/04/2013 13:02, sebb a écrit :
> > CSVPrinter#println() actually prints the record separator, not a new
> line.
> >
> > So perhaps it should be renamed?
>
> But a record separator *is* a new line :)
>
>
Not necessarily.
It's a string, which can be anything.


> Emmanuel Bourg
>
>
>

Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by Emmanuel Bourg <eb...@apache.org>.
Le 17/04/2013 13:02, sebb a écrit :
> CSVPrinter#println() actually prints the record separator, not a new line.
> 
> So perhaps it should be renamed?

But a record separator *is* a new line :)

Emmanuel Bourg



Re: [CSV] CSVPrinter#println() - should this be renamed?

Posted by Gary Gregory <ga...@gmail.com>.
That makes sense.

Gary

On Apr 17, 2013, at 7:02, sebb <se...@gmail.com> wrote:

> CSVPrinter#println() actually prints the record separator, not a new line.
>
> So perhaps it should be renamed?

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org