commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sven Maier (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (CSV-92) Need a way to extract parsed headers, e.g. for use in formatting output
Date Fri, 22 Jun 2012 22:12:42 GMT

    [ https://issues.apache.org/jira/browse/CSV-92?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13399657#comment-13399657
] 

Sven Maier commented on CSV-92:
-------------------------------

If I define a format with an empty header array  
{code}
CSVFormat myFormat = CSVFormat.BASE
.withDelimiter('|')
.withHeader();
{code} 

Then the CSVParser headerMapping map will be populated by the initializeHeader() method from
the first line from the reader. 

As it is right now, this map can not be accessed from a client. It would be great if a client
would have access to this map. 

Perhaps parser.getHeaderMapping() would be sufficient?



                
> Need a way to extract parsed headers, e.g. for use in formatting output
> -----------------------------------------------------------------------
>
>                 Key: CSV-92
>                 URL: https://issues.apache.org/jira/browse/CSV-92
>             Project: Commons CSV
>          Issue Type: New Feature
>            Reporter: Sebb
>
> Parsed header names are currently not accessible except as field key names, but these
have to be known in advance.
> It would be useful to be able to have access to the header names:
> * to use in printing a header for a new CSV file. E.g. to read a CSV file and produce
a new one with some changes made.
> * to write generic CSV applications
> The headers could be made available as a String array (in column number order) from the
CSVParser class.
> The simplest would be to store the parsed (or provided) headers and return a clone of
the array.
> If headers were not provided or requested, the method should probably return null rather
than an empty array - to be decided.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message