Skip to content
Commits on Source (2)
### https://raw.github.com/github/gitignore/14b7566ce157ce95b07006466bacee160f242284/maven.gitignore
target/
pom.xml.tag
pom.xml.releaseBackup
pom.xml.versionsBackup
pom.xml.next
release.properties
/.classpath
/.project
/.settings/
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
language: java
jdk:
- oraclejdk8
- oraclejdk11
- openjdk8
- openjdk11
- openjdk12
- openjdk-ea
after_success:
- mvn -B -V clean test jacoco:report coveralls:report -Ptravis-jacoco
\ No newline at end of file
<!---
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!---
+======================================================================+
|**** ****|
|**** THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN ****|
|**** DO NOT EDIT DIRECTLY ****|
|**** ****|
+======================================================================+
| TEMPLATE FILE: contributing-md-template.md |
| commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
+======================================================================+
| |
| 1) Re-generate using: mvn commons-build:contributing-md |
| |
| 2) Set the following properties in the component's pom: |
| - commons.jira.id (required, alphabetic, upper case) |
| |
| 3) Example Properties |
| |
| <properties> |
| <commons.jira.id>MATH</commons.jira.id> |
| </properties> |
| |
+======================================================================+
--->
Contributing to Apache Commons CSV
======================
You have found a bug or you have an idea for a cool new feature? Contributing code is a great way to give something back to
the open source community. Before you dig right into the code there are a few guidelines that we need contributors to
follow so that we can have a chance of keeping on top of things.
Getting Started
---------------
+ Make sure you have a [JIRA account](https://issues.apache.org/jira/).
+ Make sure you have a [GitHub account](https://github.com/signup/free).
+ If you're planning to implement a new feature it makes sense to discuss your changes on the [dev list](https://commons.apache.org/mail-lists.html) first. This way you can make sure you're not wasting your time on something that isn't considered to be in Apache Commons CSV's scope.
+ Submit a [Jira Ticket][jira] for your issue, assuming one does not already exist.
+ Clearly describe the issue including steps to reproduce when it is a bug.
+ Make sure you fill in the earliest version that you know has the issue.
+ Find the corresponding [repository on GitHub](https://github.com/apache/?query=commons-),
[fork](https://help.github.com/articles/fork-a-repo/) and check out your forked repository.
Making Changes
--------------
+ Create a _topic branch_ for your isolated work.
* Usually you should base your branch on the `master` or `trunk` branch.
* A good topic branch name can be the JIRA bug id plus a keyword, e.g. `CSV-123-InputStream`.
* If you have submitted multiple JIRA issues, try to maintain separate branches and pull requests.
+ Make commits of logical units.
* Make sure your commit messages are meaningful and in the proper format. Your commit message should contain the key of the JIRA issue.
* e.g. `CSV-123: Close input stream earlier`
+ Respect the original code style:
+ Only use spaces for indentation.
+ Create minimal diffs - disable _On Save_ actions like _Reformat Source Code_ or _Organize Imports_. If you feel the source code should be reformatted create a separate PR for this change first.
+ Check for unnecessary whitespace with `git diff` -- check before committing.
+ Make sure you have added the necessary tests for your changes, typically in `src/test/java`.
+ Run all the tests with `mvn clean verify` to assure nothing else was accidentally broken.
Making Trivial Changes
----------------------
The JIRA tickets are used to generate the changelog for the next release.
For changes of a trivial nature to comments and documentation, it is not always necessary to create a new ticket in JIRA.
In this case, it is appropriate to start the first line of a commit with '(doc)' instead of a ticket number.
Submitting Changes
------------------
+ Sign and submit the Apache [Contributor License Agreement][cla] if you haven't already.
* Note that small patches & typical bug fixes do not require a CLA as
clause 5 of the [Apache License](https://www.apache.org/licenses/LICENSE-2.0.html#contributions)
covers them.
+ Push your changes to a topic branch in your fork of the repository.
+ Submit a _Pull Request_ to the corresponding repository in the `apache` organization.
* Verify _Files Changed_ shows only your intended changes and does not
include additional files like `target/*.class`
+ Update your JIRA ticket and include a link to the pull request in the ticket.
If you prefer to not use GitHub, then you can instead use
`git format-patch` (or `svn diff`) and attach the patch file to the JIRA issue.
Additional Resources
--------------------
+ [Contributing patches](https://commons.apache.org/patches.html)
+ [Apache Commons CSV JIRA project page][jira]
+ [Contributor License Agreement][cla]
+ [General GitHub documentation](https://help.github.com/)
+ [GitHub pull request documentation](https://help.github.com/articles/creating-a-pull-request/)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
+ `#apache-commons` IRC channel on `irc.freenode.net`
[cla]:https://www.apache.org/licenses/#clas
[jira]:https://issues.apache.org/jira/browse/CSV
Apache Commons CSV
Copyright 2005-2017 The Apache Software Foundation
Copyright 2005-2019 The Apache Software Foundation
This product includes software developed at
The Apache Software Foundation (http://www.apache.org/).
<!---
Licensed to the Apache Software Foundation (ASF) under one or more
contributor license agreements. See the NOTICE file distributed with
this work for additional information regarding copyright ownership.
The ASF licenses this file to You under the Apache License, Version 2.0
(the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<!---
+======================================================================+
|**** ****|
|**** THIS FILE IS GENERATED BY THE COMMONS BUILD PLUGIN ****|
|**** DO NOT EDIT DIRECTLY ****|
|**** ****|
+======================================================================+
| TEMPLATE FILE: readme-md-template.md |
| commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
+======================================================================+
| |
| 1) Re-generate using: mvn commons-build:readme-md |
| |
| 2) Set the following properties in the component's pom: |
| - commons.componentid (required, alphabetic, lower case) |
| - commons.release.version (required) |
| |
| 3) Example Properties |
| |
| <properties> |
| <commons.componentid>math</commons.componentid> |
| <commons.release.version>1.2</commons.release.version> |
| </properties> |
| |
+======================================================================+
--->
Apache Commons CSV
===================
[![Build Status](https://travis-ci.org/apache/commons-csv.svg)](https://travis-ci.org/apache/commons-csv)
[![Coverage Status](https://coveralls.io/repos/apache/commons-csv/badge.svg)](https://coveralls.io/r/apache/commons-csv)
[![Maven Central](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-csv/badge.svg)](https://maven-badges.herokuapp.com/maven-central/org.apache.commons/commons-csv/)
[![Javadocs](https://javadoc.io/badge/org.apache.commons/commons-csv/1.7.svg)](https://javadoc.io/doc/org.apache.commons/commons-csv/1.7)
The Apache Commons CSV library provides a simple interface for reading and writing
CSV files of various types.
Documentation
-------------
More information can be found on the [Apache Commons CSV homepage](https://commons.apache.org/proper/commons-csv).
The [Javadoc](https://commons.apache.org/proper/commons-csv/apidocs) can be browsed.
Questions related to the usage of Apache Commons CSV should be posted to the [user mailing list][ml].
Where can I get the latest release?
-----------------------------------
You can download source and binaries from our [download page](https://commons.apache.org/proper/commons-csv/download_csv.cgi).
Alternatively you can pull it from the central Maven repositories:
```xml
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-csv</artifactId>
<version>1.7</version>
</dependency>
```
Contributing
------------
We accept Pull Requests via GitHub. The [developer mailing list][ml] is the main channel of communication for contributors.
There are some guidelines which will make applying PRs easier for us:
+ No tabs! Please use spaces for indentation.
+ Respect the code style.
+ Create minimal diffs - disable on save actions like reformat source code or organize imports. If you feel the source code should be reformatted create a separate PR for this change.
+ Provide JUnit tests for your changes and make sure your changes don't break any existing tests by running ```mvn clean test```.
If you plan to contribute on a regular basis, please consider filing a [contributor license agreement](https://www.apache.org/licenses/#clas).
You can learn more about contributing via GitHub in our [contribution guidelines](CONTRIBUTING.md).
License
-------
This code is under the [Apache Licence v2](https://www.apache.org/licenses/LICENSE-2.0).
See the `NOTICE.txt` file for required notices and attributions.
Donations
---------
You like Apache Commons CSV? Then [donate back to the ASF](https://www.apache.org/foundation/contributing.html) to support the development.
Additional Resources
--------------------
+ [Apache Commons Homepage](https://commons.apache.org/)
+ [Apache Issue Tracker (JIRA)](https://issues.apache.org/jira/browse/CSV)
+ [Apache Commons Twitter Account](https://twitter.com/ApacheCommons)
+ `#apache-commons` IRC channel on `irc.freenode.org`
[ml]:https://commons.apache.org/mail-lists.html
Apache Commons CSV
Version 1.5
Release Notes
Version 1.7
Release Notes
INTRODUCTION:
This document contains the release notes for the 1.7 version of Apache Commons CSV.
Commons CSV reads and writes files in variations of the Comma Separated Value (CSV) format.
The Apache Commons CSV library provides a simple interface for reading and writing
CSV files of various types.
Feature and bug fix release (Java 8)
Changes in this version include:
NEW FEATURES
==============
o CSV-233: Add predefined CSVFormats for printing MongoDB CSV and TSV. Thanks to Gary Gregory.
o CSV-234: Add support for java.sql.Clob. Thanks to Roberto Benedetti, Gary Gregory.
o CSV-239: Cannot get headers in column order from CSVRecord. Thanks to Gary Gregory, Dave Moten.
FIXED BUGS
============
o CSV-208: Fix escape character for POSTGRESQL_TEXT and POSTGRESQL_CSV formats. Thanks to Jurrie Overgoor.
o CSV-232: Site link "Source Repository" does not work. Thanks to Jurrie Overgoor, Gary Gregory.
o CSV-238: Escape quotes in CLOBs #39. Thanks to Stephen Olander-Waters.
CHANGES
=========
o CSV-237: Update to Java 8. Thanks to Gary Gregory.
o Update tests from H2 1.4.198 to 1.4.199. Thanks to Gary Gregory.
Historical list of changes: http://commons.apache.org/proper/commons-csv/changes-report.html
For complete information on Apache Commons CSV, including instructions on how to submit bug reports,
patches, or suggestions for improvement, see the Apache Apache Commons CSV website:
http://commons.apache.org/proper/commons-csv/
Download it from http://commons.apache.org/proper/commons-csv/download_csv.cgi
Have fun!
-Apache Commons CSV team
------------------------------------------------------------------------------
Apache Commons CSV
Version 1.6
Release Notes
INTRODUCTION:
This document contains the release notes for the 1.6 version of
Apache Commons CSV. Commons CSV reads and writes files in variations of the
Comma Separated Value (CSV) format.
CSV requires at least Java 7.
The Apache Commons CSV library provides a simple interface for reading and
writing CSV files of various types.
Feature and bug fix release.
Changes in this version include:
NEW FEATURES
==============
o CSV-217: Add autoFlush option for CsvPrinter. PR #24.
Thanks to Korolyov Alexei.
o CSV-220: Add API org.apache.commons.csv.CSVFormat.withSystemRecordSeparator().
Thanks to Gary Gregory.
FIXED BUGS
============
o CSV-219: The behavior of quote char using is not similar as Excel does when
the first string contains CJK char(s). Thanks to Zhang Hongda.
o CSV-172: Don't quote cells just because they have UTF-8 encoded characters.
Thanks to Andrew Pennebaker.
o CSV-223: Inconsistency between Javadoc of CSVFormat DEFAULT EXCEL.
Thanks to Samuel Martin.
o CSV-209: Create CSVFormat.ORACLE preset. Thanks to Gary Gregory.
o CSV-224: Some multi-iterator parsing peek sequences incorrectly consume
elements. Thanks to David Warshaw.
o CSV-225: Parse method should avoid creating a redundant BufferedReader.
Thanks to Anson Schwabecher.
CHANGES
=========
o CSV-231: Add more documentation to CSVPrinter.
Have fun!
-Apache Commons CSV team
------------------------------------------------------------------------------
Apache Commons CSV
Version 1.5
Release Notes
INTRODUCTION:
......@@ -56,8 +163,8 @@ Have fun!
------------------------------------------------------------------------------
Apache Commons CSV
Version 1.4
Release Notes
Version 1.4
Release Notes
INTRODUCTION:
......@@ -100,8 +207,8 @@ Have fun!
------------------------------------------------------------------------------
Apache Commons CSV
Version 1.3
Release Notes
Version 1.3
Release Notes
INTRODUCTION:
......@@ -139,7 +246,7 @@ o CSV-161: Fix Javadoc to say CSVFormat with() methods return a new CSVFormat.
CHANGES
============
o CSV-167: Comment line hides next record; update Javadoc to make behaviour clear. Thanks to Rene.
o CSV-167: Comment line hides next record; update Javadoc to make behavior clear. Thanks to Rene.
o CSV-153: CSVPrinter doesn't skip creation of header record if skipHeaderRecord is set to true. Thanks to Wren.
......@@ -149,8 +256,8 @@ Have fun!
------------------------------------------------------------------------------
Apache Commons CSV
Version 1.2
Release Notes
Version 1.2
Release Notes
INTRODUCTION:
......@@ -192,8 +299,8 @@ Have fun!
------------------------------------------------------------------------------
Apache Commons CSV
Version 1.1
Release Notes
Version 1.1
Release Notes
INTRODUCTION:
......@@ -238,8 +345,8 @@ Have fun!
-------------------------------------------------------------------------------
Apache Commons CSV
Version 1.0
Release Notes
Version 1.0
Release Notes
INTRODUCTION:
......
This diff is collapsed.
This diff is collapsed.
......@@ -30,7 +30,7 @@ final class Assertions {
// can not be instantiated
}
public static void notNull(final Object parameter, final String parameterName) {
static void notNull(final Object parameter, final String parameterName) {
if (parameter == null) {
throw new IllegalArgumentException("Parameter '" + parameterName + "' must not be null!");
}
......
......@@ -33,6 +33,7 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
......@@ -99,7 +100,7 @@ import java.util.TreeMap;
*
* <p>
* If the predefined formats don't match the format at hands, custom formats can be defined. More information about
* customising CSVFormats is available in {@link CSVFormat CSVFormat JavaDoc}.
* customising CSVFormats is available in {@link CSVFormat CSVFormat Javadoc}.
* </p>
*
* <h2>Parsing into memory</h2>
......@@ -133,6 +134,55 @@ import java.util.TreeMap;
*/
public final class CSVParser implements Iterable<CSVRecord>, Closeable {
class CSVRecordIterator implements Iterator<CSVRecord> {
private CSVRecord current;
private CSVRecord getNextRecord() {
try {
return CSVParser.this.nextRecord();
} catch (final IOException e) {
throw new IllegalStateException(
e.getClass().getSimpleName() + " reading next record: " + e.toString(), e);
}
}
@Override
public boolean hasNext() {
if (CSVParser.this.isClosed()) {
return false;
}
if (this.current == null) {
this.current = this.getNextRecord();
}
return this.current != null;
}
@Override
public CSVRecord next() {
if (CSVParser.this.isClosed()) {
throw new NoSuchElementException("CSVParser has been closed");
}
CSVRecord next = this.current;
this.current = null;
if (next == null) {
// hasNext() wasn't called before
next = this.getNextRecord();
if (next == null) {
throw new NoSuchElementException("No more CSV records available");
}
}
return next;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
}
/**
* Creates a parser for the given {@link File}.
*
......@@ -203,7 +253,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
public static CSVParser parse(final Path path, final Charset charset, final CSVFormat format) throws IOException {
Assertions.notNull(path, "path");
Assertions.notNull(format, "format");
return parse(Files.newBufferedReader(path, charset), format);
return parse(Files.newInputStream(path), charset, format);
}
/**
......@@ -225,7 +275,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
* If there is a problem reading the header or skipping the first record
* @since 1.5
*/
public static CSVParser parse(Reader reader, final CSVFormat format) throws IOException {
public static CSVParser parse(final Reader reader, final CSVFormat format) throws IOException {
return new CSVParser(reader, format);
}
......@@ -249,6 +299,8 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
return new CSVParser(new StringReader(string), format);
}
// the following objects are shared to reduce garbage
/**
* Creates a parser for the given URL.
*
......@@ -277,15 +329,18 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
return new CSVParser(new InputStreamReader(url.openStream(), charset), format);
}
// the following objects are shared to reduce garbage
private final CSVFormat format;
/** A mapping of column names to column indices */
private final Map<String, Integer> headerMap;
/** The column order to avoid re-computing it. */
private final List<String> headerNames;
private final Lexer lexer;
private final CSVRecordIterator csvRecordIterator;
/** A record buffer for getRecord(). Grows as necessary and is reused. */
private final List<String> recordList = new ArrayList<>();
......@@ -347,13 +402,16 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
*/
@SuppressWarnings("resource")
public CSVParser(final Reader reader, final CSVFormat format, final long characterOffset, final long recordNumber)
throws IOException {
throws IOException {
Assertions.notNull(reader, "reader");
Assertions.notNull(format, "format");
this.format = format;
this.lexer = new Lexer(format, new ExtendedBufferedReader(reader));
this.headerMap = this.initializeHeader();
this.csvRecordIterator = new CSVRecordIterator();
final Headers headers = createHeaders();
this.headerMap = headers.headerMap;
this.headerNames = headers.headerNames;
this.characterOffset = characterOffset;
this.recordNumber = recordNumber - 1;
}
......@@ -381,6 +439,94 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
}
}
private Map<String, Integer> createEmptyHeaderMap() {
return this.format.getIgnoreHeaderCase() ?
new TreeMap<>(String.CASE_INSENSITIVE_ORDER) :
new LinkedHashMap<>();
}
/**
* Header information based on name and position.
*/
private static final class Headers {
/**
* Header column positions (0-based)
*/
final Map<String, Integer> headerMap;
/**
* Header names in column order
*/
final List<String> headerNames;
Headers(final Map<String, Integer> headerMap, final List<String> headerNames) {
this.headerMap = headerMap;
this.headerNames = headerNames;
}
}
/**
* Creates the name to index mapping if the format defines a header.
*
* @return null if the format has no header.
* @throws IOException if there is a problem reading the header or skipping the first record
*/
private Headers createHeaders() throws IOException {
Map<String, Integer> hdrMap = null;
List<String> headerNames = null;
final String[] formatHeader = this.format.getHeader();
if (formatHeader != null) {
hdrMap = createEmptyHeaderMap();
String[] headerRecord = null;
if (formatHeader.length == 0) {
// read the header from the first line of the file
final CSVRecord nextRecord = this.nextRecord();
if (nextRecord != null) {
headerRecord = nextRecord.values();
}
} else {
if (this.format.getSkipHeaderRecord()) {
this.nextRecord();
}
headerRecord = formatHeader;
}
// build the name to index mappings
if (headerRecord != null) {
for (int i = 0; i < headerRecord.length; i++) {
final String header = headerRecord[i];
final boolean containsHeader = header == null ? false : hdrMap.containsKey(header);
final boolean emptyHeader = header == null || header.trim().isEmpty();
if (containsHeader) {
if (!emptyHeader && !this.format.getAllowDuplicateHeaderNames()) {
throw new IllegalArgumentException(
String.format(
"The header contains a duplicate name: \"%s\" in %s. If this is valid then use CSVFormat.withAllowDuplicateHeaderNames().",
header, Arrays.toString(headerRecord)));
}
if (emptyHeader && !this.format.getAllowMissingColumnNames()) {
throw new IllegalArgumentException(
"A header name is missing in " + Arrays.toString(headerRecord));
}
}
if (header != null) {
hdrMap.put(header, Integer.valueOf(i));
if (headerNames == null) {
headerNames = new ArrayList<>(headerRecord.length);
}
headerNames.add(header);
}
}
}
}
if (headerNames == null) {
headerNames = Collections.emptyList(); //immutable
} else {
headerNames = Collections.unmodifiableList(headerNames);
}
return new Headers(hdrMap, headerNames);
}
/**
* Returns the current line number in the input stream.
*
......@@ -406,14 +552,38 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
}
/**
* Returns a copy of the header map that iterates in column order.
* Returns a copy of the header map.
* <p>
* The map keys are column names. The map values are 0-based indices.
* </p>
* @return a copy of the header map that iterates in column order.
* @return a copy of the header map.
*/
public Map<String, Integer> getHeaderMap() {
return this.headerMap == null ? null : new LinkedHashMap<>(this.headerMap);
if (this.headerMap == null) {
return null;
}
final Map<String, Integer> map = createEmptyHeaderMap();
map.putAll(this.headerMap);
return map;
}
/**
* Returns the header map.
*
* @return the header map.
*/
Map<String, Integer> getHeaderMapRaw() {
return this.headerMap;
}
/**
* Returns a read-only list of header names that iterates in column order.
*
* @return read-only list of header names that iterates in column order.
* @since 1.7
*/
public List<String> getHeaderNames() {
return headerNames;
}
/**
......@@ -451,51 +621,6 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
return records;
}
/**
* Initializes the name to index mapping if the format defines a header.
*
* @return null if the format has no header.
* @throws IOException if there is a problem reading the header or skipping the first record
*/
private Map<String, Integer> initializeHeader() throws IOException {
Map<String, Integer> hdrMap = null;
final String[] formatHeader = this.format.getHeader();
if (formatHeader != null) {
hdrMap = this.format.getIgnoreHeaderCase() ?
new TreeMap<String, Integer>(String.CASE_INSENSITIVE_ORDER) :
new LinkedHashMap<String, Integer>();
String[] headerRecord = null;
if (formatHeader.length == 0) {
// read the header from the first line of the file
final CSVRecord nextRecord = this.nextRecord();
if (nextRecord != null) {
headerRecord = nextRecord.values();
}
} else {
if (this.format.getSkipHeaderRecord()) {
this.nextRecord();
}
headerRecord = formatHeader;
}
// build the name to index mappings
if (headerRecord != null) {
for (int i = 0; i < headerRecord.length; i++) {
final String header = headerRecord[i];
final boolean containsHeader = hdrMap.containsKey(header);
final boolean emptyHeader = header == null || header.trim().isEmpty();
if (containsHeader && (!emptyHeader || !this.format.getAllowMissingColumnNames())) {
throw new IllegalArgumentException("The header contains a duplicate name: \"" + header +
"\" in " + Arrays.toString(headerRecord));
}
hdrMap.put(header, Integer.valueOf(i));
}
}
}
return hdrMap;
}
/**
* Gets whether this parser is closed.
*
......@@ -519,54 +644,7 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
*/
@Override
public Iterator<CSVRecord> iterator() {
return new Iterator<CSVRecord>() {
private CSVRecord current;
private CSVRecord getNextRecord() {
try {
return CSVParser.this.nextRecord();
} catch (final IOException e) {
throw new IllegalStateException(
e.getClass().getSimpleName() + " reading next record: " + e.toString(), e);
}
}
@Override
public boolean hasNext() {
if (CSVParser.this.isClosed()) {
return false;
}
if (this.current == null) {
this.current = this.getNextRecord();
}
return this.current != null;
}
@Override
public CSVRecord next() {
if (CSVParser.this.isClosed()) {
throw new NoSuchElementException("CSVParser has been closed");
}
CSVRecord next = this.current;
this.current = null;
if (next == null) {
// hasNext() wasn't called before
next = this.getNextRecord();
if (next == null) {
throw new NoSuchElementException("No more CSV records available");
}
}
return next;
}
@Override
public void remove() {
throw new UnsupportedOperationException();
}
};
return csvRecordIterator;
}
/**
......@@ -615,8 +693,8 @@ public final class CSVParser implements Iterable<CSVRecord>, Closeable {
if (!this.recordList.isEmpty()) {
this.recordNumber++;
final String comment = sb == null ? null : sb.toString();
result = new CSVRecord(this.recordList.toArray(new String[this.recordList.size()]), this.headerMap, comment,
this.recordNumber, startCharPosition);
result = new CSVRecord(this, this.recordList.toArray(new String[this.recordList.size()]),
comment, this.recordNumber, startCharPosition);
}
return result;
}
......
......@@ -24,11 +24,47 @@ import static org.apache.commons.csv.Constants.SP;
import java.io.Closeable;
import java.io.Flushable;
import java.io.IOException;
import java.sql.Clob;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Arrays;
/**
* Prints values in a CSV format.
* Prints values in a {@link CSVFormat CSV format}.
*
* <p>Values can be appended to the output by calling the {@link #print(Object)} method.
* Values are printed according to {@link String#valueOf(Object)}.
* To complete a record the {@link #println()} method has to be called.
* Comments can be appended by calling {@link #printComment(String)}.
* However a comment will only be written to the output if the {@link CSVFormat} supports comments.
* </p>
*
* <p>The printer also supports appending a complete record at once by calling {@link #printRecord(Object...)}
* or {@link #printRecord(Iterable)}.
* Furthermore {@link #printRecords(Object...)}, {@link #printRecords(Iterable)} and {@link #printRecords(ResultSet)}
* methods can be used to print several records at once.
* </p>
*
* <p>Example:</p>
*
* <pre>
* try (CSVPrinter printer = new CSVPrinter(new FileWriter("csv.txt"), CSVFormat.EXCEL)) {
* printer.printRecord("id", "userName", "firstName", "lastName", "birthday");
* printer.printRecord(1, "john73", "John", "Doe", LocalDate.of(1973, 9, 15));
* printer.println();
* printer.printRecord(2, "mary", "Mary", "Meyer", LocalDate.of(1985, 3, 29));
* } catch (IOException ex) {
* ex.printStackTrace();
* }
* </pre>
*
* <p>This code will write the following to csv.txt:</p>
* <pre>
* id,userName,firstName,lastName,birthday
* 1,john73,John,Doe,1973-09-15
*
* 2,mary,Mary,Meyer,1985-03-29
* </pre>
*/
public final class CSVPrinter implements Flushable, Closeable {
......@@ -81,6 +117,21 @@ public final class CSVPrinter implements Flushable, Closeable {
@Override
public void close() throws IOException {
close(false);
}
/**
* Closes the underlying stream with an optional flush first.
* @param flush whether to flush before the actual close.
*
* @throws IOException
* If an I/O error occurs
* @since 1.6
*/
public void close(final boolean flush) throws IOException {
if (flush || format.getAutoFlush()) {
flush();
}
if (out instanceof Closeable) {
((Closeable) out).close();
}
......@@ -125,11 +176,17 @@ public final class CSVPrinter implements Flushable, Closeable {
* Prints a comment on a new line among the delimiter separated values.
*
* <p>
* Comments will always begin on a new line and occupy a least one full line. The character specified to start
* Comments will always begin on a new line and occupy at least one full line. The character specified to start
* comments and a space will be inserted at the beginning of each new line in the comment.
* </p>
*
* <p>
* If comments are disabled in the current CSV format this method does nothing.
* </p>
*
* <p>This method detects line breaks inside the comment string and inserts {@link CSVFormat#getRecordSeparator()}
* to start a new line of the comment. Note that this might produce unexpected results for formats that do not use
* line breaks as record separator.</p>
*
* @param comment
* the comment to output
......@@ -306,15 +363,7 @@ public final class CSVPrinter implements Flushable, Closeable {
* If an I/O error occurs
*/
public void printRecords(final Object... values) throws IOException {
for (final Object value : values) {
if (value instanceof Object[]) {
this.printRecord((Object[]) value);
} else if (value instanceof Iterable) {
this.printRecord((Iterable<?>) value);
} else {
this.printRecord(value);
}
}
printRecords(Arrays.asList(values));
}
/**
......@@ -331,7 +380,8 @@ public final class CSVPrinter implements Flushable, Closeable {
final int columnCount = resultSet.getMetaData().getColumnCount();
while (resultSet.next()) {
for (int i = 1; i <= columnCount; i++) {
print(resultSet.getObject(i));
final Object object = resultSet.getObject(i);
print(object instanceof Clob ? ((Clob) object).getCharacterStream() : object);
}
println();
}
......
......@@ -19,8 +19,8 @@ package org.apache.commons.csv;
import java.io.Serializable;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
......@@ -39,20 +39,20 @@ public final class CSVRecord implements Serializable, Iterable<String> {
/** The accumulated comments (if any) */
private final String comment;
/** The column name to index mapping. */
private final Map<String, Integer> mapping;
/** The record number. */
private final long recordNumber;
/** The values of the record */
private final String[] values;
CSVRecord(final String[] values, final Map<String, Integer> mapping, final String comment, final long recordNumber,
/** The parser that originates this record. */
private final CSVParser parser;
CSVRecord(final CSVParser parser, final String[] values, final String comment, final long recordNumber,
final long characterPosition) {
this.recordNumber = recordNumber;
this.values = values != null ? values : EMPTY_STRING_ARRAY;
this.mapping = mapping;
this.parser = parser;
this.comment = comment;
this.characterPosition = characterPosition;
}
......@@ -93,14 +93,15 @@ public final class CSVRecord implements Serializable, Iterable<String> {
* @see CSVFormat#withNullString(String)
*/
public String get(final String name) {
if (mapping == null) {
final Map<String, Integer> headerMap = getHeaderMapRaw();
if (headerMap == null) {
throw new IllegalStateException(
"No header mapping was specified, the record values can't be accessed by name");
}
final Integer index = mapping.get(name);
final Integer index = headerMap.get(name);
if (index == null) {
throw new IllegalArgumentException(String.format("Mapping for %s not found, expected one of %s", name,
mapping.keySet()));
headerMap.keySet()));
}
try {
return values[index.intValue()];
......@@ -133,6 +134,20 @@ public final class CSVRecord implements Serializable, Iterable<String> {
return comment;
}
private Map<String, Integer> getHeaderMapRaw() {
return parser.getHeaderMapRaw();
}
/**
* Returns the parser.
*
* @return the parser.
* @since 1.7
*/
public CSVParser getParser() {
return parser;
}
/**
* Returns the number of this record in the parsed CSV file.
*
......@@ -148,20 +163,6 @@ public final class CSVRecord implements Serializable, Iterable<String> {
return recordNumber;
}
/**
* Tells whether the record size matches the header size.
*
* <p>
* Returns true if the sizes for this record match and false if not. Some programs can export files that fail this
* test but still produce parsable files.
* </p>
*
* @return true of this record is valid, false if not
*/
public boolean isConsistent() {
return mapping == null || mapping.size() == values.length;
}
/**
* Checks whether this record has a comment, false otherwise.
* Note that comments are attached to the following record.
......@@ -175,6 +176,21 @@ public final class CSVRecord implements Serializable, Iterable<String> {
return comment != null;
}
/**
* Tells whether the record size matches the header size.
*
* <p>
* Returns true if the sizes for this record match and false if not. Some programs can export files that fail this
* test but still produce parsable files.
* </p>
*
* @return true of this record is valid, false if not
*/
public boolean isConsistent() {
final Map<String, Integer> headerMap = getHeaderMapRaw();
return headerMap == null || headerMap.size() == values.length;
}
/**
* Checks whether a given column is mapped, i.e. its name has been defined to the parser.
*
......@@ -183,7 +199,8 @@ public final class CSVRecord implements Serializable, Iterable<String> {
* @return whether a given column is mapped.
*/
public boolean isMapped(final String name) {
return mapping != null && mapping.containsKey(name);
final Map<String, Integer> headerMap = getHeaderMapRaw();
return headerMap != null && headerMap.containsKey(name);
}
/**
......@@ -194,7 +211,7 @@ public final class CSVRecord implements Serializable, Iterable<String> {
* @return whether a given columns is mapped and has a value
*/
public boolean isSet(final String name) {
return isMapped(name) && mapping.get(name).intValue() < values.length;
return isMapped(name) && getHeaderMapRaw().get(name).intValue() < values.length;
}
/**
......@@ -215,10 +232,10 @@ public final class CSVRecord implements Serializable, Iterable<String> {
* @return the given map.
*/
<M extends Map<String, String>> M putIn(final M map) {
if (mapping == null) {
if (getHeaderMapRaw() == null) {
return map;
}
for (final Entry<String, Integer> entry : mapping.entrySet()) {
for (final Entry<String, Integer> entry : getHeaderMapRaw().entrySet()) {
final int col = entry.getValue().intValue();
if (col < values.length) {
map.put(entry.getKey(), values[col]);
......@@ -248,12 +265,12 @@ public final class CSVRecord implements Serializable, Iterable<String> {
}
/**
* Copies this record into a new Map. The new map is not connect
* Copies this record into a new Map of header name to record value.
*
* @return A new Map. The map is empty if the record has no headers.
*/
public Map<String, String> toMap() {
return putIn(new HashMap<String, String>(values.length));
return putIn(new LinkedHashMap<String, String>(values.length));
}
/**
......@@ -264,9 +281,8 @@ public final class CSVRecord implements Serializable, Iterable<String> {
*/
@Override
public String toString() {
return "CSVRecord [comment=" + comment + ", mapping=" + mapping +
", recordNumber=" + recordNumber + ", values=" +
Arrays.toString(values) + "]";
return "CSVRecord [comment='" + comment + "', recordNumber=" + recordNumber + ", values=" +
Arrays.toString(values) + "]";
}
String[] values() {
......
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.apache.commons.csv;
import java.io.IOException;
import java.io.Reader;
import java.io.Writer;
import java.nio.CharBuffer;
/** Copied from Apache Commons IO. */
class IOUtils {
/**
* <p>
* Copied from Apache Commons IO.
* </p>
* The default buffer size ({@value}).
*/
static final int DEFAULT_BUFFER_SIZE = 1024 * 4;
/**
* <p>
* Copied from Apache Commons IO.
* </p>
* Represents the end-of-file (or stream).
* @since 2.5 (made public)
*/
private static final int EOF = -1;
/**
* Copies chars from a large (over 2GB) <code>Reader</code> to an <code>Appendable</code>.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
* </p>
* The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
*
* @param input the <code>Reader</code> to read from
* @param output the <code>Appendable</code> to append to
* @return the number of characters copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since 2.7
*/
static long copy(final Reader input, final Appendable output) throws IOException {
return copy(input, output, CharBuffer.allocate(DEFAULT_BUFFER_SIZE));
}
/**
* Copies chars from a large (over 2GB) <code>Reader</code> to an <code>Appendable</code>.
* <p>
* This method uses the provided buffer, so there is no need to use a
* <code>BufferedReader</code>.
* </p>
*
* @param input the <code>Reader</code> to read from
* @param output the <code>Appendable</code> to write to
* @param buffer the buffer to be used for the copy
* @return the number of characters copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since 2.7
*/
static long copy(final Reader input, final Appendable output, final CharBuffer buffer) throws IOException {
long count = 0;
int n;
while (EOF != (n = input.read(buffer))) {
buffer.flip();
output.append(buffer, 0, n);
count += n;
}
return count;
}
/**
* <p>
* Copied from Apache Commons IO.
* </p>
* Copies chars from a large (over 2GB) <code>Reader</code> to a <code>Writer</code>.
* <p>
* This method buffers the input internally, so there is no need to use a
* <code>BufferedReader</code>.
* <p>
* The buffer size is given by {@link #DEFAULT_BUFFER_SIZE}.
*
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to write to
* @return the number of characters copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since 1.3
*/
static long copyLarge(final Reader input, final Writer output) throws IOException {
return copyLarge(input, output, new char[DEFAULT_BUFFER_SIZE]);
}
/**
* <p>
* Copied from Apache Commons IO.
* </p>
* Copies chars from a large (over 2GB) <code>Reader</code> to a <code>Writer</code>.
* <p>
* This method uses the provided buffer, so there is no need to use a
* <code>BufferedReader</code>.
* <p>
*
* @param input the <code>Reader</code> to read from
* @param output the <code>Writer</code> to write to
* @param buffer the buffer to be used for the copy
* @return the number of characters copied
* @throws NullPointerException if the input or output is null
* @throws IOException if an I/O error occurs
* @since 2.2
*/
static long copyLarge(final Reader input, final Writer output, final char[] buffer) throws IOException {
long count = 0;
int n;
while (EOF != (n = input.read(buffer))) {
output.write(buffer, 0, n);
count += n;
}
return count;
}
}
......@@ -38,8 +38,8 @@ import java.io.IOException;
*/
final class Lexer implements Closeable {
private static final String CR_STRING = Character.toString(Constants.CR);
private static final String LF_STRING = Character.toString(Constants.LF);
private static final String CR_STRING = Character.toString(CR);
private static final String LF_STRING = Character.toString(LF);
/**
* Constant char to use for disabling comments, escapes and encapsulation. The value -2 is used because it
......@@ -326,7 +326,7 @@ final class Lexer implements Closeable {
* @return the unescaped character (as an int) or {@link Constants#END_OF_STREAM} if char following the escape is
* invalid.
* @throws IOException if there is a problem reading the stream or the end of stream is detected:
* the escape character is not allowed at end of strem
* the escape character is not allowed at end of stream
*/
int readEscape() throws IOException {
// the escape char has just been read (normally a backslash)
......
......@@ -17,8 +17,7 @@
package org.apache.commons.csv;
/**
* Defines quote behavior when printing.
*
* Defines quoting behavior when printing.
*/
public enum QuoteMode {
......@@ -33,8 +32,8 @@ public enum QuoteMode {
ALL_NON_NULL,
/**
* Quotes fields which contain special characters such as a delimiter, quotes character or any of the characters in
* line separator.
* Quotes fields which contain special characters such as a the field delimiter, quote character or any of the
* characters in the line separator string.
*/
MINIMAL,
......@@ -44,8 +43,8 @@ public enum QuoteMode {
NON_NUMERIC,
/**
* Never quotes fields. When the delimiter occurs in data, the printer prefixes it with the current escape
* character. If the escape character is not set, format validation throws an exception.
* Never quotes fields. When the delimiter occurs in data, the printer prefixes it with the escape character. If the
* escape character is not set, format validation throws an exception.
*/
NONE
}
......@@ -34,26 +34,19 @@
</menu>
<menu name="Development">
<item name="History" href="/changes-report.html"/>
<item name="Mailing Lists" href="/mail-lists.html"/>
<item name="Issue Tracking" href="/issue-tracking.html"/>
<item name="Team" href="/team-list.html"/>
<item name="Source Repository" href="/source-repository.html"/>
<item name="Javadoc trunk" href="/apidocs/index.html"/>
<item name="Javadoc 1.5" href="/archives/1.5/apidocs/index.html"/>
<item name="Javadoc 1.4" href="/archives/1.4/apidocs/index.html"/>
<item name="Javadoc 1.3" href="/archives/1.3/apidocs/index.html"/>
<item name="Javadoc 1.2" href="/archives/1.2/apidocs/index.html"/>
<item name="Javadoc 1.1" href="/archives/1.1/apidocs/index.html"/>
<item name="Javadoc 1.0" href="/archives/1.0/apidocs/index.html"/>
</menu>
<menu name="Site Archives">
<item name="CSV 1.4" href="/archives/1.4/index.html"/>
<item name="CSV 1.3" href="/archives/1.3/index.html"/>
<item name="CSV 1.2" href="/archives/1.2/index.html"/>
<item name="CSV 1.1" href="/archives/1.1/index.html"/>
<item name="CSV 1.0" href="/archives/1.0/index.html"/>
<item name="History" href="/changes-report.html"/>
<item name="Mailing Lists" href="/mail-lists.html"/>
<item name="Issue Tracking" href="/issue-tracking.html"/>
<item name="Team" href="/team.html"/>
<item name="Javadoc" href="/apidocs/index.html"/>
<item name="Javadoc 1.7" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.7"/>
<item name="Javadoc 1.6" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.6"/>
<item name="Javadoc 1.5" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.5"/>
<item name="Javadoc 1.4" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.4"/>
<item name="Javadoc 1.3" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.3"/>
<item name="Javadoc 1.2" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.2"/>
<item name="Javadoc 1.1" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.1"/>
<item name="Javadoc 1.0" href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.0"/>
</menu>
</body>
......
......@@ -26,22 +26,24 @@ limitations under the License.
| commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
+======================================================================+
| |
| 1) Re-generate using: mvn commons:download-page |
| 1) Re-generate using: mvn commons-build:download-page |
| |
| 2) Set the following properties in the component's pom: |
| - commons.componentid (required, alphabetic, lower case) |
| - commons.componentid (required, alphabetic, lower case) |
| - commons.release.version (required) |
| - commons.release.name (required) |
| - commons.binary.suffix (optional) |
| (defaults to "-bin", set to "" for pre-maven2 releases) |
| - commons.release.desc (optional) |
| - commons.release.subdir (optional) |
| - commons.release.hash (optional, lowercase, default sha512) |
| |
| - commons.release.2/3.version (conditional) |
| - commons.release.2/3.name (conditional) |
| - commons.release.2/3.binary.suffix (optional) |
| - commons.release.2/3.desc (optional) |
| - commons.release.2/3.subdir (optional) |
| - commons.release.[234].version (conditional) |
| - commons.release.[234].name (conditional) |
| - commons.release.[234].binary.suffix (optional) |
| - commons.release.[234].desc (optional) |
| - commons.release.[234].subdir (optional) |
| - commons.release.[234].hash (optional, lowercase, [sha512])|
| |
| 3) Example Properties |
| (commons.release.name inherited by parent: |
......@@ -102,7 +104,7 @@ limitations under the License.
It is essential that you
<a href="https://www.apache.org/info/verification.html">verify the integrity</a>
of downloaded files, preferably using the <code>PGP</code> signature (<code>*.asc</code> files);
failing that using the <code>MD5</code> hash (<code>*.md5</code> checksum files).
failing that using the <code>SHA512</code> hash (<code>*.sha512</code> checksum files).
</p>
<p>
The <a href="https://www.apache.org/dist/commons/KEYS">KEYS</a>
......@@ -111,32 +113,32 @@ limitations under the License.
</p>
</subsection>
</section>
<section name="Apache Commons CSV 1.5 (Java 7+)">
<section name="Apache Commons CSV 1.7 (Java 8)">
<subsection name="Binaries">
<table>
<tr>
<td><a href="[preferred]/commons/csv/binaries/commons-csv-1.5-bin.tar.gz">commons-csv-1.5-bin.tar.gz</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.tar.gz.md5">md5</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.tar.gz.asc">pgp</a></td>
<td><a href="[preferred]/commons/csv/binaries/commons-csv-1.7-bin.tar.gz">commons-csv-1.7-bin.tar.gz</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.7-bin.tar.gz.sha512">sha512</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.7-bin.tar.gz.asc">pgp</a></td>
</tr>
<tr>
<td><a href="[preferred]/commons/csv/binaries/commons-csv-1.5-bin.zip">commons-csv-1.5-bin.zip</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.zip.md5">md5</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.5-bin.zip.asc">pgp</a></td>
<td><a href="[preferred]/commons/csv/binaries/commons-csv-1.7-bin.zip">commons-csv-1.7-bin.zip</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.7-bin.zip.sha512">sha512</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/binaries/commons-csv-1.7-bin.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
<subsection name="Source">
<table>
<tr>
<td><a href="[preferred]/commons/csv/source/commons-csv-1.5-src.tar.gz">commons-csv-1.5-src.tar.gz</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.tar.gz.md5">md5</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.tar.gz.asc">pgp</a></td>
<td><a href="[preferred]/commons/csv/source/commons-csv-1.7-src.tar.gz">commons-csv-1.7-src.tar.gz</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.7-src.tar.gz.sha512">sha512</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.7-src.tar.gz.asc">pgp</a></td>
</tr>
<tr>
<td><a href="[preferred]/commons/csv/source/commons-csv-1.5-src.zip">commons-csv-1.5-src.zip</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.zip.md5">md5</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.5-src.zip.asc">pgp</a></td>
<td><a href="[preferred]/commons/csv/source/commons-csv-1.7-src.zip">commons-csv-1.7-src.zip</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.7-src.zip.sha512">sha512</a></td>
<td><a href="https://www.apache.org/dist/commons/csv/source/commons-csv-1.7-src.zip.asc">pgp</a></td>
</tr>
</table>
</subsection>
......
......@@ -30,6 +30,9 @@ limitations under the License.
<li><a href="http://www.ibm.com/support/knowledgecenter/SSBJG3_2.5.0/com.ibm.gen_busug.doc/c_fgl_InOutSql_UNLOAD.htm">Informix UNLOAD</a></li>
<li><a href="http://www.ibm.com/support/knowledgecenter/SSBJG3_2.5.0/com.ibm.gen_busug.doc/c_fgl_InOutSql_UNLOAD.htm">Informix UNLOAD CSV</a></li>
<li><a href="http://dev.mysql.com/doc/refman/5.0/en/mysqldump-delimited-text.html">MySQL</a></li>
<li><a href="hhttps://docs.oracle.com/database/121/SUTIL/GUID-D1762699-8154-40F6-90DE-EFB8EB6A9AB0.htm#SUTIL4217">Oracle</a></li>
<li><a href="https://www.postgresql.org/docs/current/static/sql-copy.html">PostgreSQL CSV</a></li>
<li><a href="https://www.postgresql.org/docs/current/static/sql-copy.html">PostgreSQL Text</a></li>
<li><a href="http://tools.ietf.org/html/rfc4180">RFC 4180</a></li>
<li><a href="http://en.wikipedia.org/wiki/Tab-separated_values">TDF</a></li>
</ul>
......@@ -48,12 +51,13 @@ The Javadoc API documents are available online:
</p>
<ul>
<li><a href="apidocs/index.html">Javadoc trunk</a></li>
<li><a href="archives/1.5/apidocs/index.html">Javadoc 1.5</a></li>
<li><a href="archives/1.4/apidocs/index.html">Javadoc 1.4</a></li>
<li><a href="archives/1.3/apidocs/index.html">Javadoc 1.3</a></li>
<li><a href="archives/1.2/apidocs/index.html">Javadoc 1.2</a></li>
<li><a href="archives/1.1/apidocs/index.html">Javadoc 1.1</a></li>
<li><a href="archives/1.0/apidocs/index.html">Javadoc 1.0</a></li>
<li><a href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.6">Javadoc 1.6</a></li>
<li><a href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.5">Javadoc 1.5</a></li>
<li><a href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.4">Javadoc 1.4</a></li>
<li><a href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.3">Javadoc 1.3</a></li>
<li><a href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.2">Javadoc 1.2</a></li>
<li><a href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.1">Javadoc 1.1</a></li>
<li><a href="https://javadoc.io/doc/org.apache.commons/commons-csv/1.0">Javadoc 1.0</a></li>
</ul>
<p>
The <a href="source-repository.html">git repository</a> can be
......@@ -63,12 +67,14 @@ The <a href="source-repository.html">git repository</a> can be
<!-- ================================================== -->
<section name="Releases">
<ul>
<li><a href="http://commons.apache.org/csv/download_csv.cgi">Apache Commons CSV 1.5 (mirrors)</a> requires Java 1.7</li>
<li><a href="http://commons.apache.org/dist/commons/csv/">Apache Commons CSV 1.4 (archives)</a> requires Java 1.6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.3 (archives)</a> requires Java 1.6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.2 (archives)</a> requires Java 1.6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.1 (archives)</a> requires Java 1.6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.0 (archives)</a> requires Java 1.6</li>
<li><a href="http://commons.apache.org/csv/download_csv.cgi">Apache Commons CSV 1.7 (mirrors)</a> requires Java 8</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.6 (archives)</a> requires Java 7</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.5 (archives)</a> requires Java 7</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.4 (archives)</a> requires Java 6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.3 (archives)</a> requires Java 6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.2 (archives)</a> requires Java 6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.1 (archives)</a> requires Java 6</li>
<li><a href="http://archive.apache.org/dist/commons/csv/">Apache Commons CSV 1.0 (archives)</a> requires Java 6</li>
</ul>
<p>
See the
......@@ -86,7 +92,7 @@ For previous releases, see the <a href="http://archive.apache.org/dist/commons/c
<pre>&lt;dependency&gt;
&lt;groupId&gt;org.apache.commons&lt;/groupId&gt;
&lt;artifactId&gt;commons-csv&lt;/artifactId&gt;
&lt;version&gt;1.5&lt;/version&gt;
&lt;version&gt;1.7&lt;/version&gt;
&lt;/dependency&gt;</pre>
</p>
<p>
......
......@@ -26,7 +26,7 @@ limitations under the License.
| commons-build-plugin/trunk/src/main/resources/commons-xdoc-templates |
+======================================================================+
| |
| 1) Re-generate using: mvn commons:jira-page |
| 1) Re-generate using: mvn commons-build:jira-page |
| |
| 2) Set the following properties in the component's pom: |
| - commons.jira.id (required, alphabetic, upper case) |
......