commons-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gary Gregory <garydgreg...@gmail.com>
Subject Re: [CSV] Record Separator query
Date Wed, 09 Aug 2017 18:18:02 GMT
If you look at the Javadoc or the code for CSVFormat.RFC4180 you will see
that this format uses CR LF.

Gary

On Wed, Aug 9, 2017 at 10:51 AM, nitin mahendru <nitin.mahendru88@gmail.com>
wrote:

> Hi Gary,
>
> Thanks for a quick turnaround. We are using the below code to parse our
> input csv:
> CSVFormat.RFC4180.withIgnoreEmptyLines(true).parse(new
> InputStreamReader(this.getStreamIn(), readerCharset))
>
> We never tell the parser what line separator to expect and it automatically
> figures it out. What I want to know is that is it possible to extract this
> knowledge from the CSVParser object returned by the above as to what line
> separator it found ?
>
> -Nitin
>
>
> On Tue, Aug 8, 2017 at 3:23 PM Gary Gregory <garydgregory@gmail.com>
> wrote:
>
> > Hi Nitin,
> >
> > You _tell_ the parser what record separator to use, the parser does not
> > tell you.
> >
> > Gary
> >
> >
> > On Aug 8, 2017 16:13, "nitin mahendru" <nitin.mahendru88@gmail.com>
> wrote:
> >
> > Hello All,
> >
> > I am trying to read in a csv file which may be 'crlf' or 'lf' seperated.
> > Then I want to change a particular column, say encrypt it and then write
> > back a new csv with that updated column. I want to use the same record
> > separator as was in the input file.
> >
> > Is there a way to get the record separator back from the CSVParser
> object ?
> > I am planning to use the below method to get the writer.
> > CSVFormat.RFC4180.withRecordSeparator(<need to add record
> > separator).print()
> >
> > For using the above I need to know the record separator upfront which I
> > have no clue about as the Parser object does not expose that detail.
> >
> > thanks
> >
> > Nitin
> >
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message