[
https://issues.apache.org/jira/browse/CSV-110?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13961691#comment-13961691
]
Gabriel Reid commented on CSV-110:
----------------------------------
I understand the notion of it feeling like a layer on top. I think ideally
(from this use case point of view) the API would separate the parser itself
from its input, e.g. a single parser could be used to iterate over different
inputs. If this were in place, there would also be no need for a LineParser
class.
That being said, CSV is of course a pretty special format where the definition
of the parser itself is often linked to the input. Also, changing the basic
concepts of the API probably isn't really desirable this close to a 1.0
(although if you're considering it, I'd be more than willing to assist of
course).
In any case, if we can get some method of parsing CSV entries individually
without needing to instantiate a new CSVParser for each entry (and without
having to do some kind of hack to access package-private classes and methods),
then I'll be very happy.
> Add ability to parse single lines
> ---------------------------------
>
> Key: CSV-110
> URL: https://issues.apache.org/jira/browse/CSV-110
> Project: Commons CSV
> Issue Type: New Feature
> Reporter: Gabriel Reid
> Attachments: CSV-110.patch
>
>
> Due to the iterator-based API of CSVParser, there is currently no simple and
> convenient way to parse single lines of CSV-formatted data. The intention of
> this ticket is to add something along the lines of the following:
> {code}
> CSVLineParser lineParser = new CSVLineParser(csvFormat);
> String singleLine = "a,b,c";
> CSVRecord singleRecord lineParser.parseLine(singleLine);
> {code}
> The use case of parsing single lines comes up very often in terms of
> distributed batch processing scenarios (i.e. Hadoop jobs), and CSV-style
> formats are also regularly used in such scenarios. Currently, projects are
> often forced to build their own ad-hoc CSV parsing solutions, so adding the
> ability to parse single lines to commons-csv would be very useful to these
> projects, as well as anyone doing parsing based on input that isn't necessary
> in the form of a single stream.
--
This message was sent by Atlassian JIRA
(v6.2#6252)