You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@commons.apache.org by gg...@apache.org on 2025/03/19 22:20:07 UTC
svn commit: r1089465 [28/43] - in /websites/production/commons/content/proper/commons-csv: ./ apidocs/ apidocs/legal/ apidocs/org/apache/commons/csv/ apidocs/org/apache/commons/csv/class-use/ apidocs/resource-files/ apidocs/resources/ apidocs/script-di...
Modified: websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVParser.java.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVParser.java.html (original)
+++ websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVParser.java.html Wed Mar 19 22:20:06 2025
@@ -49,6 +49,7 @@ import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
+import org.apache.commons.io.Charsets;
import org.apache.commons.io.build.AbstractStreamBuilder;
import org.apache.commons.io.function.Uncheck;
@@ -154,20 +155,20 @@ public final class CSVParser implements
private CSVFormat format;
private long characterOffset;
-<span class="fc" id="L157"> private long recordNumber = 1;</span>
+<span class="fc" id="L158"> private long recordNumber = 1;</span>
private boolean trackBytes;
/**
* Constructs a new instance.
*/
-<span class="fc" id="L163"> protected Builder() {</span>
+<span class="fc" id="L164"> protected Builder() {</span>
// empty
-<span class="fc" id="L165"> }</span>
+<span class="fc" id="L166"> }</span>
@SuppressWarnings("resource")
@Override
public CSVParser get() throws IOException {
-<span class="fc bfc" id="L170" title="All 2 branches covered."> return new CSVParser(getReader(), format != null ? format : CSVFormat.DEFAULT, characterOffset, recordNumber, getCharset(), trackBytes);</span>
+<span class="fc bfc" id="L171" title="All 2 branches covered."> return new CSVParser(getReader(), format != null ? format : CSVFormat.DEFAULT, characterOffset, recordNumber, getCharset(), trackBytes);</span>
}
/**
@@ -177,19 +178,19 @@ public final class CSVParser implements
* @return this instance.
*/
public Builder setCharacterOffset(final long characterOffset) {
-<span class="fc" id="L180"> this.characterOffset = characterOffset;</span>
-<span class="fc" id="L181"> return asThis();</span>
+<span class="fc" id="L181"> this.characterOffset = characterOffset;</span>
+<span class="fc" id="L182"> return asThis();</span>
}
/**
* Sets the CSV format. A copy of the given format is kept.
*
- * @param format the CSV format, null is equivalent to {@link CSVFormat#DEFAULT}.
+ * @param format the CSV format, {@code null} resets to {@link CSVFormat#DEFAULT}.
* @return this instance.
*/
public Builder setFormat(final CSVFormat format) {
-<span class="fc" id="L191"> this.format = CSVFormat.copy(format);</span>
-<span class="fc" id="L192"> return asThis();</span>
+<span class="fc" id="L192"> this.format = CSVFormat.copy(format);</span>
+<span class="fc" id="L193"> return asThis();</span>
}
/**
@@ -199,8 +200,8 @@ public final class CSVParser implements
* @return this instance.
*/
public Builder setRecordNumber(final long recordNumber) {
-<span class="fc" id="L202"> this.recordNumber = recordNumber;</span>
-<span class="fc" id="L203"> return asThis();</span>
+<span class="fc" id="L203"> this.recordNumber = recordNumber;</span>
+<span class="fc" id="L204"> return asThis();</span>
}
/**
@@ -211,60 +212,61 @@ public final class CSVParser implements
* @since 1.13.0
*/
public Builder setTrackBytes(final boolean trackBytes) {
-<span class="fc" id="L214"> this.trackBytes = trackBytes;</span>
-<span class="fc" id="L215"> return asThis();</span>
+<span class="fc" id="L215"> this.trackBytes = trackBytes;</span>
+<span class="fc" id="L216"> return asThis();</span>
}
}
-<span class="fc" id="L220"> final class CSVRecordIterator implements Iterator<CSVRecord> {</span>
+<span class="fc" id="L221"> final class CSVRecordIterator implements Iterator<CSVRecord> {</span>
private CSVRecord current;
/**
- * Gets the next record.
+ * Gets the next record or null at the end of stream or max rows read.
*
* @throws IOException on parse error or input read-failure
* @throws CSVException on invalid input.
- * @return the next record.
+ * @return the next record, or {@code null} if the end of the stream has been reached.
*/
private CSVRecord getNextRecord() {
-<span class="fc" id="L231"> return Uncheck.get(CSVParser.this::nextRecord);</span>
+<span class="fc" id="L232"> CSVRecord record = null;</span>
+<span class="fc bfc" id="L233" title="All 2 branches covered."> if (format.useRow(recordNumber + 1)) {</span>
+<span class="fc" id="L234"> record = Uncheck.get(CSVParser.this::nextRecord);</span>
+ }
+<span class="fc" id="L236"> return record;</span>
}
@Override
public boolean hasNext() {
-<span class="fc bfc" id="L236" title="All 2 branches covered."> if (isClosed()) {</span>
-<span class="fc" id="L237"> return false;</span>
+<span class="fc bfc" id="L241" title="All 2 branches covered."> if (isClosed()) {</span>
+<span class="fc" id="L242"> return false;</span>
}
-<span class="fc bfc" id="L239" title="All 2 branches covered."> if (current == null) {</span>
-<span class="fc" id="L240"> current = getNextRecord();</span>
+<span class="fc bfc" id="L244" title="All 2 branches covered."> if (current == null) {</span>
+<span class="fc" id="L245"> current = getNextRecord();</span>
}
-
-<span class="fc bfc" id="L243" title="All 2 branches covered."> return current != null;</span>
+<span class="fc bfc" id="L247" title="All 2 branches covered."> return current != null;</span>
}
@Override
public CSVRecord next() {
-<span class="fc bfc" id="L248" title="All 2 branches covered."> if (isClosed()) {</span>
-<span class="fc" id="L249"> throw new NoSuchElementException("CSVParser has been closed");</span>
+<span class="fc bfc" id="L252" title="All 2 branches covered."> if (isClosed()) {</span>
+<span class="fc" id="L253"> throw new NoSuchElementException("CSVParser has been closed");</span>
}
-<span class="fc" id="L251"> CSVRecord next = current;</span>
-<span class="fc" id="L252"> current = null;</span>
-
-<span class="fc bfc" id="L254" title="All 2 branches covered."> if (next == null) {</span>
+<span class="fc" id="L255"> CSVRecord next = current;</span>
+<span class="fc" id="L256"> current = null;</span>
+<span class="fc bfc" id="L257" title="All 2 branches covered."> if (next == null) {</span>
// hasNext() wasn't called before
-<span class="fc" id="L256"> next = getNextRecord();</span>
-<span class="fc bfc" id="L257" title="All 2 branches covered."> if (next == null) {</span>
-<span class="fc" id="L258"> throw new NoSuchElementException("No more CSV records available");</span>
+<span class="fc" id="L259"> next = getNextRecord();</span>
+<span class="fc bfc" id="L260" title="All 2 branches covered."> if (next == null) {</span>
+<span class="fc" id="L261"> throw new NoSuchElementException("No more CSV records available");</span>
}
}
-
-<span class="fc" id="L262"> return next;</span>
+<span class="fc" id="L264"> return next;</span>
}
@Override
public void remove() {
-<span class="fc" id="L267"> throw new UnsupportedOperationException();</span>
+<span class="fc" id="L269"> throw new UnsupportedOperationException();</span>
}
}
/**
@@ -282,10 +284,10 @@ public final class CSVParser implements
*/
final List<String> headerNames;
-<span class="fc" id="L285"> Headers(final Map<String, Integer> headerMap, final List<String> headerNames) {</span>
-<span class="fc" id="L286"> this.headerMap = headerMap;</span>
-<span class="fc" id="L287"> this.headerNames = headerNames;</span>
-<span class="fc" id="L288"> }</span>
+<span class="fc" id="L287"> Headers(final Map<String, Integer> headerMap, final List<String> headerNames) {</span>
+<span class="fc" id="L288"> this.headerMap = headerMap;</span>
+<span class="fc" id="L289"> this.headerNames = headerNames;</span>
+<span class="fc" id="L290"> }</span>
}
/**
@@ -295,7 +297,7 @@ public final class CSVParser implements
* @since 1.13.0
*/
public static Builder builder() {
-<span class="fc" id="L298"> return new Builder();</span>
+<span class="fc" id="L300"> return new Builder();</span>
}
/**
@@ -304,19 +306,20 @@ public final class CSVParser implements
* @param file
* a CSV file. Must not be null.
* @param charset
- * The Charset to decode the given file.
+ * The Charset to decode the given file, {@code null} maps to the {@link Charset#defaultCharset() default Charset}.
* @param format
- * the CSVFormat used for CSV parsing. Must not be null.
+ * the CSVFormat used for CSV parsing, {@code null} maps to {@link CSVFormat#DEFAULT}.
* @return a new parser
* @throws IllegalArgumentException
- * If the parameters of the format are inconsistent or if either file or format are null.
+ * If the parameters of the format are inconsistent.
* @throws IOException
* If an I/O error occurs
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
+ * @throws NullPointerException if {@code file} is {@code null}.
*/
public static CSVParser parse(final File file, final Charset charset, final CSVFormat format) throws IOException {
-<span class="fc" id="L318"> Objects.requireNonNull(file, "file");</span>
-<span class="fc" id="L319"> return parse(file.toPath(), charset, format);</span>
+<span class="fc" id="L321"> Objects.requireNonNull(file, "file");</span>
+<span class="fc" id="L322"> return parse(file.toPath(), charset, format);</span>
}
/**
@@ -328,25 +331,22 @@ public final class CSVParser implements
* </p>
*
* @param inputStream
- * an InputStream containing CSV-formatted input. Must not be null.
+ * an InputStream containing CSV-formatted input, {@code null} maps to {@link CSVFormat#DEFAULT}.
* @param charset
- * The Charset to decode the given file.
+ * The Charset to decode the given file, {@code null} maps to the {@link Charset#defaultCharset() default Charset}.
* @param format
- * the CSVFormat used for CSV parsing. Must not be null.
+ * the CSVFormat used for CSV parsing, {@code null} maps to {@link CSVFormat#DEFAULT}.
* @return a new CSVParser configured with the given reader and format.
* @throws IllegalArgumentException
* If the parameters of the format are inconsistent or if either reader or format are null.
* @throws IOException
* If there is a problem reading the header or skipping the first record
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
* @since 1.5
*/
- @SuppressWarnings("resource")
public static CSVParser parse(final InputStream inputStream, final Charset charset, final CSVFormat format)
throws IOException {
-<span class="fc" id="L347"> Objects.requireNonNull(inputStream, "inputStream");</span>
-<span class="fc" id="L348"> Objects.requireNonNull(format, "format");</span>
-<span class="fc" id="L349"> return parse(new InputStreamReader(inputStream, charset), format);</span>
+<span class="fc" id="L349"> return parse(new InputStreamReader(inputStream, Charsets.toCharset(charset)), format);</span>
}
/**
@@ -355,21 +355,21 @@ public final class CSVParser implements
* @param path
* a CSV file. Must not be null.
* @param charset
- * The Charset to decode the given file.
+ * The Charset to decode the given file, {@code null} maps to the {@link Charset#defaultCharset() default Charset}.
* @param format
- * the CSVFormat used for CSV parsing. Must not be null.
+ * the CSVFormat used for CSV parsing, {@code null} maps to {@link CSVFormat#DEFAULT}.
* @return a new parser
* @throws IllegalArgumentException
- * If the parameters of the format are inconsistent or if either file or format are null.
+ * If the parameters of the format are inconsistent.
* @throws IOException
* If an I/O error occurs
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
+ * @throws NullPointerException if {@code path} is {@code null}.
* @since 1.5
*/
@SuppressWarnings("resource")
public static CSVParser parse(final Path path, final Charset charset, final CSVFormat format) throws IOException {
-<span class="fc" id="L371"> Objects.requireNonNull(path, "path");</span>
-<span class="fc" id="L372"> Objects.requireNonNull(format, "format");</span>
+<span class="fc" id="L372"> Objects.requireNonNull(path, "path");</span>
<span class="fc" id="L373"> return parse(Files.newInputStream(path), charset, format);</span>
}
@@ -384,13 +384,13 @@ public final class CSVParser implements
* @param reader
* a Reader containing CSV-formatted input. Must not be null.
* @param format
- * the CSVFormat used for CSV parsing. Must not be null.
+ * the CSVFormat used for CSV parsing, {@code null} maps to {@link CSVFormat#DEFAULT}.
* @return a new CSVParser configured with the given reader and format.
* @throws IllegalArgumentException
* If the parameters of the format are inconsistent or if either reader or format are null.
* @throws IOException
* If there is a problem reading the header or skipping the first record
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
* @since 1.5
*/
public static CSVParser parse(final Reader reader, final CSVFormat format) throws IOException {
@@ -403,17 +403,17 @@ public final class CSVParser implements
* @param string
* a CSV string. Must not be null.
* @param format
- * the CSVFormat used for CSV parsing. Must not be null.
+ * the CSVFormat used for CSV parsing, {@code null} maps to {@link CSVFormat#DEFAULT}.
* @return a new parser
* @throws IllegalArgumentException
- * If the parameters of the format are inconsistent or if either string or format are null.
+ * If the parameters of the format are inconsistent.
* @throws IOException
* If an I/O error occurs
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
+ * @throws NullPointerException if {@code string} is {@code null}.
*/
public static CSVParser parse(final String string, final CSVFormat format) throws IOException {
-<span class="fc" id="L415"> Objects.requireNonNull(string, "string");</span>
-<span class="fc" id="L416"> Objects.requireNonNull(format, "format");</span>
+<span class="fc" id="L416"> Objects.requireNonNull(string, "string");</span>
<span class="fc" id="L417"> return parse(new StringReader(string), format);</span>
}
@@ -428,20 +428,21 @@ public final class CSVParser implements
* @param url
* a URL. Must not be null.
* @param charset
- * the charset for the resource. Must not be null.
+ * the charset for the resource, {@code null} maps to the {@link Charset#defaultCharset() default Charset}.
* @param format
- * the CSVFormat used for CSV parsing. Must not be null.
+ * the CSVFormat used for CSV parsing, {@code null} maps to {@link CSVFormat#DEFAULT}.
* @return a new parser
* @throws IllegalArgumentException
- * If the parameters of the format are inconsistent or if either url, charset or format are null.
+ * If the parameters of the format are inconsistent.
* @throws IOException
* If an I/O error occurs
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
+ * @throws NullPointerException if {@code url} is {@code null}.
*/
@SuppressWarnings("resource")
public static CSVParser parse(final URL url, final Charset charset, final CSVFormat format) throws IOException {
-<span class="fc" id="L443"> Objects.requireNonNull(url, "url");</span>
-<span class="fc" id="L444"> return parse(url.openStream(), charset, format);</span>
+<span class="fc" id="L444"> Objects.requireNonNull(url, "url");</span>
+<span class="fc" id="L445"> return parse(url.openStream(), charset, format);</span>
}
private String headerComment;
@@ -457,7 +458,7 @@ public final class CSVParser implements
private final CSVRecordIterator csvRecordIterator;
/** A record buffer for getRecord(). Grows as necessary and is reused. */
-<span class="fc" id="L460"> private final List<String> recordList = new ArrayList<>();</span>
+<span class="fc" id="L461"> private final List<String> recordList = new ArrayList<>();</span>
/**
* The next record number to assign.
@@ -470,10 +471,10 @@ public final class CSVParser implements
*/
private final long characterOffset;
-<span class="fc" id="L473"> private final Token reusableToken = new Token();</span>
+<span class="fc" id="L474"> private final Token reusableToken = new Token();</span>
/**
- * Constructs a new instance using the given {@link CSVFormat}
+ * Constructs a new instance using the given {@link CSVFormat}.
*
* <p>
* If you do not read all records from the given {@code reader}, you should call {@link #close()} on the parser,
@@ -488,16 +489,16 @@ public final class CSVParser implements
* If the parameters of the format are inconsistent or if either reader or format are null.
* @throws IOException
* If there is a problem reading the header or skipping the first record
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
* @deprecated Will be removed in the next major version, use {@link Builder#get()}.
*/
@Deprecated
public CSVParser(final Reader reader, final CSVFormat format) throws IOException {
-<span class="fc" id="L496"> this(reader, format, 0, 1);</span>
-<span class="fc" id="L497"> }</span>
+<span class="fc" id="L497"> this(reader, format, 0, 1);</span>
+<span class="fc" id="L498"> }</span>
/**
- * Constructs a new instance using the given {@link CSVFormat}
+ * Constructs a new instance using the given {@link CSVFormat}.
*
* <p>
* If you do not read all records from the given {@code reader}, you should call {@link #close()} on the parser,
@@ -518,16 +519,15 @@ public final class CSVParser implements
* if there is a problem reading the header or skipping the first record
* @throws CSVException on invalid input.
* @since 1.1
- * @deprecated Will be private in the next major version, use {@link Builder#get()}.
+ * @deprecated Will be removed in the next major version, use {@link Builder#get()}.
*/
@Deprecated
- public CSVParser(final Reader reader, final CSVFormat format, final long characterOffset, final long recordNumber)
- throws IOException {
-<span class="fc" id="L526"> this(reader, format, characterOffset, recordNumber, null, false);</span>
-<span class="fc" id="L527"> }</span>
+ public CSVParser(final Reader reader, final CSVFormat format, final long characterOffset, final long recordNumber) throws IOException {
+<span class="fc" id="L526"> this(reader, format, characterOffset, recordNumber, null, false);</span>
+<span class="fc" id="L527"> }</span>
/**
- * Constructs a new instance using the given {@link CSVFormat}
+ * Constructs a new instance using the given {@link CSVFormat}.
*
* <p>
* If you do not read all records from the given {@code reader}, you should call {@link #close()} on the parser,
@@ -550,7 +550,7 @@ public final class CSVParser implements
* If the parameters of the format are inconsistent or if either the reader or format is null.
* @throws IOException
* If there is a problem reading the header or skipping the first record.
- * @throws CSVException Thrown on invalid input.
+ * @throws CSVException Thrown on invalid CSV input data.
*/
private CSVParser(final Reader reader, final CSVFormat format, final long characterOffset, final long recordNumber,
final Charset charset, final boolean trackBytes)
@@ -598,11 +598,11 @@ public final class CSVParser implements
* @throws CSVException on invalid input.
*/
private Headers createHeaders() throws IOException {
-<span class="fc" id="L601"> Map<String, Integer> hdrMap = null;</span>
+<span class="fc" id="L601"> Map<String, Integer> headerMap = null;</span>
<span class="fc" id="L602"> List<String> headerNames = null;</span>
<span class="fc" id="L603"> final String[] formatHeader = format.getHeader();</span>
<span class="fc bfc" id="L604" title="All 2 branches covered."> if (formatHeader != null) {</span>
-<span class="fc" id="L605"> hdrMap = createEmptyHeaderMap();</span>
+<span class="fc" id="L605"> headerMap = createEmptyHeaderMap();</span>
<span class="fc" id="L606"> String[] headerRecord = null;</span>
<span class="fc bfc" id="L607" title="All 2 branches covered."> if (formatHeader.length == 0) {</span>
// read the header from the first line of the file
@@ -620,67 +620,62 @@ public final class CSVParser implements
}
<span class="fc" id="L621"> headerRecord = formatHeader;</span>
}
-
// build the name to index mappings
-<span class="fc bfc" id="L625" title="All 2 branches covered."> if (headerRecord != null) {</span>
+<span class="fc bfc" id="L624" title="All 2 branches covered."> if (headerRecord != null) {</span>
// Track an occurrence of a null, empty or blank header.
-<span class="fc" id="L627"> boolean observedMissing = false;</span>
-<span class="fc bfc" id="L628" title="All 2 branches covered."> for (int i = 0; i < headerRecord.length; i++) {</span>
-<span class="fc" id="L629"> final String header = headerRecord[i];</span>
-<span class="fc" id="L630"> final boolean blankHeader = CSVFormat.isBlank(header);</span>
-<span class="fc bfc" id="L631" title="All 4 branches covered."> if (blankHeader && !format.getAllowMissingColumnNames()) {</span>
-<span class="fc" id="L632"> throw new IllegalArgumentException(</span>
-<span class="fc" id="L633"> "A header name is missing in " + Arrays.toString(headerRecord));</span>
+<span class="fc" id="L626"> boolean observedMissing = false;</span>
+<span class="fc bfc" id="L627" title="All 2 branches covered."> for (int i = 0; i < headerRecord.length; i++) {</span>
+<span class="fc" id="L628"> final String header = headerRecord[i];</span>
+<span class="fc" id="L629"> final boolean blankHeader = CSVFormat.isBlank(header);</span>
+<span class="fc bfc" id="L630" title="All 4 branches covered."> if (blankHeader && !format.getAllowMissingColumnNames()) {</span>
+<span class="fc" id="L631"> throw new IllegalArgumentException("A header name is missing in " + Arrays.toString(headerRecord));</span>
}
-
-<span class="fc bfc" id="L636" title="All 2 branches covered."> final boolean containsHeader = blankHeader ? observedMissing : hdrMap.containsKey(header);</span>
-<span class="fc" id="L637"> final DuplicateHeaderMode headerMode = format.getDuplicateHeaderMode();</span>
-<span class="fc bfc" id="L638" title="All 2 branches covered."> final boolean duplicatesAllowed = headerMode == DuplicateHeaderMode.ALLOW_ALL;</span>
-<span class="fc bfc" id="L639" title="All 2 branches covered."> final boolean emptyDuplicatesAllowed = headerMode == DuplicateHeaderMode.ALLOW_EMPTY;</span>
-
-<span class="fc bfc" id="L641" title="All 8 branches covered."> if (containsHeader && !duplicatesAllowed && !(blankHeader && emptyDuplicatesAllowed)) {</span>
-<span class="fc" id="L642"> throw new IllegalArgumentException(</span>
-<span class="fc" id="L643"> String.format(</span>
+<span class="fc bfc" id="L633" title="All 2 branches covered."> final boolean containsHeader = blankHeader ? observedMissing : headerMap.containsKey(header);</span>
+<span class="fc" id="L634"> final DuplicateHeaderMode headerMode = format.getDuplicateHeaderMode();</span>
+<span class="fc bfc" id="L635" title="All 2 branches covered."> final boolean duplicatesAllowed = headerMode == DuplicateHeaderMode.ALLOW_ALL;</span>
+<span class="fc bfc" id="L636" title="All 2 branches covered."> final boolean emptyDuplicatesAllowed = headerMode == DuplicateHeaderMode.ALLOW_EMPTY;</span>
+<span class="fc bfc" id="L637" title="All 8 branches covered."> if (containsHeader && !duplicatesAllowed && !(blankHeader && emptyDuplicatesAllowed)) {</span>
+<span class="fc" id="L638"> throw new IllegalArgumentException(String.format(</span>
"The header contains a duplicate name: \"%s\" in %s. If this is valid then use CSVFormat.Builder.setDuplicateHeaderMode().",
-<span class="fc" id="L645"> header, Arrays.toString(headerRecord)));</span>
+<span class="fc" id="L640"> header, Arrays.toString(headerRecord)));</span>
}
-<span class="fc" id="L647"> observedMissing |= blankHeader;</span>
-<span class="fc bfc" id="L648" title="All 2 branches covered."> if (header != null) {</span>
-<span class="fc" id="L649"> hdrMap.put(header, Integer.valueOf(i)); // N.B. Explicit (un)boxing is intentional</span>
-<span class="fc bfc" id="L650" title="All 2 branches covered."> if (headerNames == null) {</span>
-<span class="fc" id="L651"> headerNames = new ArrayList<>(headerRecord.length);</span>
+<span class="fc" id="L642"> observedMissing |= blankHeader;</span>
+<span class="fc bfc" id="L643" title="All 2 branches covered."> if (header != null) {</span>
+<span class="fc" id="L644"> headerMap.put(header, Integer.valueOf(i)); // Explicit (un)boxing is intentional</span>
+<span class="fc bfc" id="L645" title="All 2 branches covered."> if (headerNames == null) {</span>
+<span class="fc" id="L646"> headerNames = new ArrayList<>(headerRecord.length);</span>
}
-<span class="fc" id="L653"> headerNames.add(header);</span>
+<span class="fc" id="L648"> headerNames.add(header);</span>
}
}
}
}
// Make header names Collection immutable
-<span class="fc bfc" id="L659" title="All 2 branches covered."> return new Headers(hdrMap, headerNames == null ? Collections.emptyList() : Collections.unmodifiableList(headerNames));</span>
+<span class="fc bfc" id="L654" title="All 2 branches covered."> return new Headers(headerMap, headerNames == null ? Collections.emptyList() : Collections.unmodifiableList(headerNames));</span>
}
/**
* Gets the current line number in the input stream.
*
* <p>
- * <strong>ATTENTION:</strong> If your CSV input has multi-line values, the returned number does not correspond to
+ * <strong>Note:</strong> If your CSV input has multi-line values, the returned number does not correspond to
* the record number.
* </p>
*
- * @return current line number
+ * @return current line number.
*/
public long getCurrentLineNumber() {
-<span class="fc" id="L673"> return lexer.getCurrentLineNumber();</span>
+<span class="fc" id="L668"> return lexer.getCurrentLineNumber();</span>
}
/**
* Gets the first end-of-line string encountered.
*
- * @return the first end-of-line string
+ * @return the first end-of-line string.
* @since 1.5
*/
public String getFirstEndOfLine() {
-<span class="fc" id="L683"> return lexer.getFirstEol();</span>
+<span class="fc" id="L678"> return lexer.getFirstEol();</span>
}
/**
@@ -691,7 +686,7 @@ public final class CSVParser implements
* @since 1.10.0
*/
public String getHeaderComment() {
-<span class="fc" id="L694"> return headerComment;</span>
+<span class="fc" id="L689"> return headerComment;</span>
}
/**
@@ -700,19 +695,19 @@ public final class CSVParser implements
* The map keys are column names. The map values are 0-based indices.
* </p>
* <p>
- * Note: The map can only provide a one-to-one mapping when the format did not
+ * <strong>Note:</strong> The map can only provide a one-to-one mapping when the format did not
* contain null or duplicate column names.
* </p>
*
* @return a copy of the header map.
*/
public Map<String, Integer> getHeaderMap() {
-<span class="fc bfc" id="L710" title="All 2 branches covered."> if (headers.headerMap == null) {</span>
-<span class="fc" id="L711"> return null;</span>
+<span class="fc bfc" id="L705" title="All 2 branches covered."> if (headers.headerMap == null) {</span>
+<span class="fc" id="L706"> return null;</span>
}
-<span class="fc" id="L713"> final Map<String, Integer> map = createEmptyHeaderMap();</span>
-<span class="fc" id="L714"> map.putAll(headers.headerMap);</span>
-<span class="fc" id="L715"> return map;</span>
+<span class="fc" id="L708"> final Map<String, Integer> map = createEmptyHeaderMap();</span>
+<span class="fc" id="L709"> map.putAll(headers.headerMap);</span>
+<span class="fc" id="L710"> return map;</span>
}
/**
@@ -721,7 +716,7 @@ public final class CSVParser implements
* @return the underlying header map.
*/
Map<String, Integer> getHeaderMapRaw() {
-<span class="fc" id="L724"> return headers.headerMap;</span>
+<span class="fc" id="L719"> return headers.headerMap;</span>
}
/**
@@ -737,21 +732,21 @@ public final class CSVParser implements
* @since 1.7
*/
public List<String> getHeaderNames() {
-<span class="fc" id="L740"> return Collections.unmodifiableList(headers.headerNames);</span>
+<span class="fc" id="L735"> return Collections.unmodifiableList(headers.headerNames);</span>
}
/**
* Gets the current record number in the input stream.
*
* <p>
- * <strong>ATTENTION:</strong> If your CSV input has multi-line values, the returned number does not correspond to
+ * <strong>Note:</strong> If your CSV input has multi-line values, the returned number does not correspond to
* the line number.
* </p>
*
* @return current record number
*/
public long getRecordNumber() {
-<span class="fc" id="L754"> return recordNumber;</span>
+<span class="fc" id="L749"> return recordNumber;</span>
}
/**
@@ -761,13 +756,16 @@ public final class CSVParser implements
* <p>
* The returned content starts at the current parse-position in the stream.
* </p>
+ * <p>
+ * You can use {@link CSVFormat.Builder#setMaxRows(long)} to limit how many rows this method produces.
+ * </p>
*
* @return list of {@link CSVRecord CSVRecords}, may be empty
* @throws UncheckedIOException
* on parse error or input read-failure
*/
public List<CSVRecord> getRecords() {
-<span class="fc" id="L770"> return stream().collect(Collectors.toList());</span>
+<span class="fc" id="L768"> return stream().collect(Collectors.toList());</span>
}
/**
@@ -778,7 +776,7 @@ public final class CSVParser implements
* @since 1.10.0
*/
public String getTrailerComment() {
-<span class="fc" id="L781"> return trailerComment;</span>
+<span class="fc" id="L779"> return trailerComment;</span>
}
/**
@@ -789,15 +787,15 @@ public final class CSVParser implements
* @return null if input is parsed as null, or input itself if the input isn't parsed as null
*/
private String handleNull(final String input) {
-<span class="fc" id="L792"> final boolean isQuoted = reusableToken.isQuoted;</span>
-<span class="fc" id="L793"> final String nullString = format.getNullString();</span>
-<span class="fc" id="L794"> final boolean strictQuoteMode = isStrictQuoteMode();</span>
-<span class="fc bfc" id="L795" title="All 2 branches covered."> if (input.equals(nullString)) {</span>
+<span class="fc" id="L790"> final boolean isQuoted = reusableToken.isQuoted;</span>
+<span class="fc" id="L791"> final String nullString = format.getNullString();</span>
+<span class="fc" id="L792"> final boolean strictQuoteMode = isStrictQuoteMode();</span>
+<span class="fc bfc" id="L793" title="All 2 branches covered."> if (input.equals(nullString)) {</span>
// nullString = NULL(String), distinguish between "NULL" and NULL in ALL_NON_NULL or NON_NUMERIC quote mode
-<span class="fc bfc" id="L797" title="All 4 branches covered."> return strictQuoteMode && isQuoted ? input : null;</span>
+<span class="fc bfc" id="L795" title="All 4 branches covered."> return strictQuoteMode && isQuoted ? input : null;</span>
}
// don't set nullString, distinguish between "" and ,, (absent values) in All_NON_NULL or NON_NUMERIC quote mode
-<span class="fc bfc" id="L800" title="All 8 branches covered."> return strictQuoteMode && nullString == null && input.isEmpty() && !isQuoted ? null : input;</span>
+<span class="fc bfc" id="L798" title="All 8 branches covered."> return strictQuoteMode && nullString == null && input.isEmpty() && !isQuoted ? null : input;</span>
}
/**
@@ -813,7 +811,7 @@ public final class CSVParser implements
* @since 1.10.0
*/
public boolean hasHeaderComment() {
-<span class="fc bfc" id="L816" title="All 2 branches covered."> return headerComment != null;</span>
+<span class="fc bfc" id="L814" title="All 2 branches covered."> return headerComment != null;</span>
}
/**
@@ -826,7 +824,7 @@ public final class CSVParser implements
* @since 1.10.0
*/
public boolean hasTrailerComment() {
-<span class="fc bfc" id="L829" title="All 2 branches covered."> return trailerComment != null;</span>
+<span class="fc bfc" id="L827" title="All 2 branches covered."> return trailerComment != null;</span>
}
/**
@@ -835,7 +833,7 @@ public final class CSVParser implements
* @return whether this parser is closed.
*/
public boolean isClosed() {
-<span class="fc" id="L838"> return lexer.isClosed();</span>
+<span class="fc" id="L836"> return lexer.isClosed();</span>
}
/**
@@ -845,8 +843,8 @@ public final class CSVParser implements
* {@link QuoteMode#NON_NUMERIC}.
*/
private boolean isStrictQuoteMode() {
-<span class="fc bfc" id="L848" title="All 2 branches covered."> return format.getQuoteMode() == QuoteMode.ALL_NON_NULL ||</span>
-<span class="fc bfc" id="L849" title="All 2 branches covered."> format.getQuoteMode() == QuoteMode.NON_NUMERIC;</span>
+<span class="fc bfc" id="L846" title="All 2 branches covered."> return format.getQuoteMode() == QuoteMode.ALL_NON_NULL ||</span>
+<span class="fc bfc" id="L847" title="All 2 branches covered."> format.getQuoteMode() == QuoteMode.NON_NUMERIC;</span>
}
/**
@@ -867,65 +865,68 @@ public final class CSVParser implements
* parser is closed, one option is to extract all records as a list with
* {@link #getRecords()}, and return an iterator to that list.
* </p>
+ * <p>
+ * You can use {@link CSVFormat.Builder#setMaxRows(long)} to limit how many rows an Iterator produces.
+ * </p>
*/
@Override
public Iterator<CSVRecord> iterator() {
-<span class="fc" id="L873"> return csvRecordIterator;</span>
+<span class="fc" id="L874"> return csvRecordIterator;</span>
}
/**
* Parses the next record from the current point in the stream.
*
- * @return the record as an array of values, or {@code null} if the end of the stream has been reached
- * @throws IOException on parse error or input read-failure
- * @throws CSVException on invalid input.
+ * @return the record as an array of values, or {@code null} if the end of the stream has been reached.
+ * @throws IOException on parse error or input read-failure.
+ * @throws CSVException on invalid CSV input data.
*/
CSVRecord nextRecord() throws IOException {
-<span class="fc" id="L884"> CSVRecord result = null;</span>
-<span class="fc" id="L885"> recordList.clear();</span>
-<span class="fc" id="L886"> StringBuilder sb = null;</span>
-<span class="fc" id="L887"> final long startCharPosition = lexer.getCharacterPosition() + characterOffset;</span>
-<span class="fc" id="L888"> final long startBytePosition = lexer.getBytesRead() + this.characterOffset;</span>
+<span class="fc" id="L885"> CSVRecord result = null;</span>
+<span class="fc" id="L886"> recordList.clear();</span>
+<span class="fc" id="L887"> StringBuilder sb = null;</span>
+<span class="fc" id="L888"> final long startCharPosition = lexer.getCharacterPosition() + characterOffset;</span>
+<span class="fc" id="L889"> final long startBytePosition = lexer.getBytesRead() + this.characterOffset;</span>
do {
-<span class="fc" id="L890"> reusableToken.reset();</span>
-<span class="fc" id="L891"> lexer.nextToken(reusableToken);</span>
-<span class="pc bpc" id="L892" title="2 of 6 branches missed."> switch (reusableToken.type) {</span>
+<span class="fc" id="L891"> reusableToken.reset();</span>
+<span class="fc" id="L892"> lexer.nextToken(reusableToken);</span>
+<span class="pc bpc" id="L893" title="2 of 6 branches missed."> switch (reusableToken.type) {</span>
case TOKEN:
-<span class="fc" id="L894"> addRecordValue(false);</span>
-<span class="fc" id="L895"> break;</span>
+<span class="fc" id="L895"> addRecordValue(false);</span>
+<span class="fc" id="L896"> break;</span>
case EORECORD:
-<span class="fc" id="L897"> addRecordValue(true);</span>
-<span class="fc" id="L898"> break;</span>
+<span class="fc" id="L898"> addRecordValue(true);</span>
+<span class="fc" id="L899"> break;</span>
case EOF:
-<span class="fc bfc" id="L900" title="All 2 branches covered."> if (reusableToken.isReady) {</span>
-<span class="fc" id="L901"> addRecordValue(true);</span>
-<span class="fc bfc" id="L902" title="All 2 branches covered."> } else if (sb != null) {</span>
-<span class="fc" id="L903"> trailerComment = sb.toString();</span>
+<span class="fc bfc" id="L901" title="All 2 branches covered."> if (reusableToken.isReady) {</span>
+<span class="fc" id="L902"> addRecordValue(true);</span>
+<span class="fc bfc" id="L903" title="All 2 branches covered."> } else if (sb != null) {</span>
+<span class="fc" id="L904"> trailerComment = sb.toString();</span>
}
break;
case INVALID:
-<span class="nc" id="L907"> throw new CSVException("(line %,d) invalid parse sequence", getCurrentLineNumber());</span>
+<span class="nc" id="L908"> throw new CSVException("(line %,d) invalid parse sequence", getCurrentLineNumber());</span>
case COMMENT: // Ignored currently
-<span class="fc bfc" id="L909" title="All 2 branches covered."> if (sb == null) { // first comment for this record</span>
-<span class="fc" id="L910"> sb = new StringBuilder();</span>
+<span class="fc bfc" id="L910" title="All 2 branches covered."> if (sb == null) { // first comment for this record</span>
+<span class="fc" id="L911"> sb = new StringBuilder();</span>
} else {
-<span class="fc" id="L912"> sb.append(Constants.LF);</span>
+<span class="fc" id="L913"> sb.append(Constants.LF);</span>
}
-<span class="fc" id="L914"> sb.append(reusableToken.content);</span>
-<span class="fc" id="L915"> reusableToken.type = TOKEN; // Read another token</span>
-<span class="fc" id="L916"> break;</span>
+<span class="fc" id="L915"> sb.append(reusableToken.content);</span>
+<span class="fc" id="L916"> reusableToken.type = TOKEN; // Read another token</span>
+<span class="fc" id="L917"> break;</span>
default:
-<span class="nc" id="L918"> throw new CSVException("Unexpected Token type: %s", reusableToken.type);</span>
+<span class="nc" id="L919"> throw new CSVException("Unexpected Token type: %s", reusableToken.type);</span>
}
-<span class="fc bfc" id="L920" title="All 2 branches covered."> } while (reusableToken.type == TOKEN);</span>
+<span class="fc bfc" id="L921" title="All 2 branches covered."> } while (reusableToken.type == TOKEN);</span>
-<span class="fc bfc" id="L922" title="All 2 branches covered."> if (!recordList.isEmpty()) {</span>
-<span class="fc" id="L923"> recordNumber++;</span>
-<span class="fc" id="L924"> final String comment = Objects.toString(sb, null);</span>
-<span class="fc" id="L925"> result = new CSVRecord(this, recordList.toArray(Constants.EMPTY_STRING_ARRAY), comment,</span>
+<span class="fc bfc" id="L923" title="All 2 branches covered."> if (!recordList.isEmpty()) {</span>
+<span class="fc" id="L924"> recordNumber++;</span>
+<span class="fc" id="L925"> final String comment = Objects.toString(sb, null);</span>
+<span class="fc" id="L926"> result = new CSVRecord(this, recordList.toArray(Constants.EMPTY_STRING_ARRAY), comment,</span>
recordNumber, startCharPosition, startBytePosition);
}
-<span class="fc" id="L928"> return result;</span>
+<span class="fc" id="L929"> return result;</span>
}
/**
@@ -934,11 +935,15 @@ public final class CSVParser implements
* If the parser is closed, the stream will not produce any more values.
* See the comments in {@link #iterator()}.
* </p>
+ * <p>
+ * You can use {@link CSVFormat.Builder#setMaxRows(long)} to limit how many rows a Stream produces.
+ * </p>
+ *
* @return a sequential {@code Stream} with this collection as its source.
* @since 1.9.0
*/
public Stream<CSVRecord> stream() {
-<span class="fc" id="L941"> return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.ORDERED), false);</span>
+<span class="fc" id="L946"> return StreamSupport.stream(Spliterators.spliteratorUnknownSize(iterator(), Spliterator.ORDERED), false);</span>
}
}
Modified: websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVPrinter.html
==============================================================================
--- websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVPrinter.html (original)
+++ websites/production/commons/content/proper/commons-csv/jacoco/org.apache.commons.csv/CSVPrinter.html Wed Mar 19 22:20:06 2025
@@ -1 +1 @@
-<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CSVPrinter</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons CSV</a> > <a href="index.html" class="el_package">org.apache.commons.csv</a> > <span class="el_class">CSVPrinter</span></div><h1>CSVPrinter</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td cla
ss="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">0 of 334</td><td class="ctr2">100%</td><td class="bar">0 of 45</td><td class="ctr2">100%</td><td class="ctr1">0</td><td class="ctr2">43</td><td class="ctr
1">0</td><td class="ctr2">93</td><td class="ctr1">0</td><td class="ctr2">20</td></tr></tfoot><tbody><tr><td id="a8"><a href="CSVPrinter.java.html#L224" class="el_method">printComment(String)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="77" alt="77"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="15" alt="15"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f0">0</td><td class="ctr2" id="g0">9</td><td class="ctr1" id="h0">0</td><td class="ctr2" id="i0">18</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="CSVPrinter.java.html#L86" class="el_method">CSVPrinter(Appendable, CSVFormat)</a></td><td class="bar" id="b1"><img src="../jacoco-resources/greenbar.gif" width="87" height="10" title="56" alt="56"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d1"><img src="../jac
oco-resources/greenbar.gif" width="64" height="10" title="8" alt="8"/></td><td class="ctr2" id="e1">100%</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g1">5</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">13</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a17"><a href="CSVPrinter.java.html#L440" class="el_method">printRecords(ResultSet)</a></td><td class="bar" id="b2"><img src="../jacoco-resources/greenbar.gif" width="73" height="10" title="47" alt="47"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d2"><img src="../jacoco-resources/greenbar.gif" width="64" height="10" title="8" alt="8"/></td><td class="ctr2" id="e2">100%</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g2">5</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">13</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a14"><a href="CSVPrinter.java.html#L336" class="el_method">printRecordObject(Object)</a><
/td><td class="bar" id="b3"><img src="../jacoco-resources/greenbar.gif" width="38" height="10" title="25" alt="25"/></td><td class="ctr2" id="c3">100%</td><td class="bar" id="d4"><img src="../jacoco-resources/greenbar.gif" width="32" height="10" title="4" alt="4"/></td><td class="ctr2" id="e3">100%</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g4">3</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i3">6</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr><tr><td id="a1"><a href="CSVPrinter.java.html#L138" class="el_method">close(boolean)</a></td><td class="bar" id="b4"><img src="../jacoco-resources/greenbar.gif" width="26" height="10" title="17" alt="17"/></td><td class="ctr2" id="c4">100%</td><td class="bar" id="d3"><img src="../jacoco-resources/greenbar.gif" width="48" height="10" title="6" alt="6"/></td><td class="ctr2" id="e4">100%</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g3">4</td><td class="ctr1" id="h4">0</td><td class="ctr2"
id="i4">5</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr><tr><td id="a9"><a href="CSVPrinter.java.html#L262" class="el_method">printHeaders(ResultSet)</a></td><td class="bar" id="b5"><img src="../jacoco-resources/greenbar.gif" width="24" height="10" title="16" alt="16"/></td><td class="ctr2" id="c5">100%</td><td class="bar" id="d7"/><td class="ctr2" id="e7">n/a</td><td class="ctr1" id="f5">0</td><td class="ctr2" id="g7">1</td><td class="ctr1" id="h5">0</td><td class="ctr2" id="i5">4</td><td class="ctr1" id="j5">0</td><td class="ctr2" id="k5">1</td></tr><tr><td id="a7"><a href="CSVPrinter.java.html#L198" class="el_method">print(Object)</a></td><td class="bar" id="b6"><img src="../jacoco-resources/greenbar.gif" width="18" height="10" title="12" alt="12"/></td><td class="ctr2" id="c6">100%</td><td class="bar" id="d8"/><td class="ctr2" id="e8">n/a</td><td class="ctr1" id="f6">0</td><td class="ctr2" id="g8">1</td><td class="ctr1" id="h6">0</td><td class="ctr2" id
="i7">3</td><td class="ctr1" id="j6">0</td><td class="ctr2" id="k6">1</td></tr><tr><td id="a3"><a href="CSVPrinter.java.html#L153" class="el_method">endOfRecord()</a></td><td class="bar" id="b7"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c7">100%</td><td class="bar" id="d9"/><td class="ctr2" id="e9">n/a</td><td class="ctr1" id="f7">0</td><td class="ctr2" id="g9">1</td><td class="ctr1" id="h7">0</td><td class="ctr2" id="i8">3</td><td class="ctr1" id="j7">0</td><td class="ctr2" id="k7">1</td></tr><tr><td id="a4"><a href="CSVPrinter.java.html#L165" class="el_method">flush()</a></td><td class="bar" id="b8"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c8">100%</td><td class="bar" id="d5"><img src="../jacoco-resources/greenbar.gif" width="16" height="10" title="2" alt="2"/></td><td class="ctr2" id="e5">100%</td><td class="ctr1" id="f8">0</td><td class="ct
r2" id="g5">2</td><td class="ctr1" id="h8">0</td><td class="ctr2" id="i9">3</td><td class="ctr1" id="j8">0</td><td class="ctr2" id="k8">1</td></tr><tr><td id="a10"><a href="CSVPrinter.java.html#L275" class="el_method">println()</a></td><td class="bar" id="b9"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c9">100%</td><td class="bar" id="d10"/><td class="ctr2" id="e10">n/a</td><td class="ctr1" id="f9">0</td><td class="ctr2" id="g10">1</td><td class="ctr1" id="h9">0</td><td class="ctr2" id="i10">3</td><td class="ctr1" id="j9">0</td><td class="ctr2" id="k9">1</td></tr><tr><td id="a18"><a href="CSVPrinter.java.html#L470" class="el_method">printRecords(ResultSet, boolean)</a></td><td class="bar" id="b10"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c10">100%</td><td class="bar" id="d6"><img src="../jacoco-resources/greenbar.gif" width="16" height="10" title
="2" alt="2"/></td><td class="ctr2" id="e6">100%</td><td class="ctr1" id="f10">0</td><td class="ctr2" id="g6">2</td><td class="ctr1" id="h10">0</td><td class="ctr2" id="i6">4</td><td class="ctr1" id="j10">0</td><td class="ctr2" id="k10">1</td></tr><tr><td id="a11"><a href="CSVPrinter.java.html#L294" class="el_method">printRecord(Iterable)</a></td><td class="bar" id="b11"><img src="../jacoco-resources/greenbar.gif" width="12" height="10" title="8" alt="8"/></td><td class="ctr2" id="c11">100%</td><td class="bar" id="d11"/><td class="ctr2" id="e11">n/a</td><td class="ctr1" id="f11">0</td><td class="ctr2" id="g11">1</td><td class="ctr1" id="h11">0</td><td class="ctr2" id="i11">3</td><td class="ctr1" id="j11">0</td><td class="ctr2" id="k11">1</td></tr><tr><td id="a13"><a href="CSVPrinter.java.html#L331" class="el_method">printRecord(Stream)</a></td><td class="bar" id="b12"><img src="../jacoco-resources/greenbar.gif" width="12" height="10" title="8" alt="8"/></td><td class="ctr2" id="c12"
>100%</td><td class="bar" id="d12"/><td class="ctr2" id="e12">n/a</td><td class="ctr1" id="f12">0</td><td class="ctr2" id="g12">1</td><td class="ctr1" id="h12">0</td><td class="ctr2" id="i12">3</td><td class="ctr1" id="j12">0</td><td class="ctr2" id="k12">1</td></tr><tr><td id="a15"><a href="CSVPrinter.java.html#L385" class="el_method">printRecords(Iterable)</a></td><td class="bar" id="b13"><img src="../jacoco-resources/greenbar.gif" width="9" height="10" title="6" alt="6"/></td><td class="ctr2" id="c13">100%</td><td class="bar" id="d13"/><td class="ctr2" id="e13">n/a</td><td class="ctr1" id="f13">0</td><td class="ctr2" id="g13">1</td><td class="ctr1" id="h13">0</td><td class="ctr2" id="i13">2</td><td class="ctr1" id="j13">0</td><td class="ctr2" id="k13">1</td></tr><tr><td id="a19"><a href="CSVPrinter.java.html#L518" class="el_method">printRecords(Stream)</a></td><td class="bar" id="b14"><img src="../jacoco-resources/greenbar.gif" width="9" height="10" title="6" alt="6"/></td><td cl
ass="ctr2" id="c14">100%</td><td class="bar" id="d14"/><td class="ctr2" id="e14">n/a</td><td class="ctr1" id="f14">0</td><td class="ctr2" id="g14">1</td><td class="ctr1" id="h14">0</td><td class="ctr2" id="i14">2</td><td class="ctr1" id="j14">0</td><td class="ctr2" id="k14">1</td></tr><tr><td id="a12"><a href="CSVPrinter.java.html#L312" class="el_method">printRecord(Object[])</a></td><td class="bar" id="b15"><img src="../jacoco-resources/greenbar.gif" width="7" height="10" title="5" alt="5"/></td><td class="ctr2" id="c15">100%</td><td class="bar" id="d15"/><td class="ctr2" id="e15">n/a</td><td class="ctr1" id="f15">0</td><td class="ctr2" id="g15">1</td><td class="ctr1" id="h15">0</td><td class="ctr2" id="i15">2</td><td class="ctr1" id="j15">0</td><td class="ctr2" id="k15">1</td></tr><tr><td id="a16"><a href="CSVPrinter.java.html#L426" class="el_method">printRecords(Object[])</a></td><td class="bar" id="b16"><img src="../jacoco-resources/greenbar.gif" width="7" height="10" title="5"
alt="5"/></td><td class="ctr2" id="c16">100%</td><td class="bar" id="d16"/><td class="ctr2" id="e16">n/a</td><td class="ctr1" id="f16">0</td><td class="ctr2" id="g16">1</td><td class="ctr1" id="h16">0</td><td class="ctr2" id="i16">2</td><td class="ctr1" id="j16">0</td><td class="ctr2" id="k16">1</td></tr><tr><td id="a0"><a href="CSVPrinter.java.html#L127" class="el_method">close()</a></td><td class="bar" id="b17"><img src="../jacoco-resources/greenbar.gif" width="6" height="10" title="4" alt="4"/></td><td class="ctr2" id="c17">100%</td><td class="bar" id="d17"/><td class="ctr2" id="e17">n/a</td><td class="ctr1" id="f17">0</td><td class="ctr2" id="g17">1</td><td class="ctr1" id="h17">0</td><td class="ctr2" id="i17">2</td><td class="ctr1" id="j17">0</td><td class="ctr2" id="k17">1</td></tr><tr><td id="a5"><a href="CSVPrinter.java.html#L176" class="el_method">getOut()</a></td><td class="bar" id="b18"><img src="../jacoco-resources/greenbar.gif" width="4" height="10" title="3" alt="3"/><
/td><td class="ctr2" id="c18">100%</td><td class="bar" id="d18"/><td class="ctr2" id="e18">n/a</td><td class="ctr1" id="f18">0</td><td class="ctr2" id="g18">1</td><td class="ctr1" id="h18">0</td><td class="ctr2" id="i18">1</td><td class="ctr1" id="j18">0</td><td class="ctr2" id="k18">1</td></tr><tr><td id="a6"><a href="CSVPrinter.java.html#L186" class="el_method">getRecordCount()</a></td><td class="bar" id="b19"><img src="../jacoco-resources/greenbar.gif" width="4" height="10" title="3" alt="3"/></td><td class="ctr2" id="c19">100%</td><td class="bar" id="d19"/><td class="ctr2" id="e19">n/a</td><td class="ctr1" id="f19">0</td><td class="ctr2" id="g19">1</td><td class="ctr1" id="h19">0</td><td class="ctr2" id="i19">1</td><td class="ctr1" id="j19">0</td><td class="ctr2" id="k19">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
\ No newline at end of file
+<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../jacoco-resources/report.gif" type="image/gif"/><title>CSVPrinter</title><script type="text/javascript" src="../jacoco-resources/sort.js"></script></head><body onload="initialSort(['breadcrumb'])"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../index.html" class="el_report">Apache Commons CSV</a> > <a href="index.html" class="el_package">org.apache.commons.csv</a> > <span class="el_class">CSVPrinter</span></div><h1>CSVPrinter</h1><table class="coverage" cellspacing="0" id="coveragetable"><thead><tr><td cla
ss="sortable" id="a" onclick="toggleSort(this)">Element</td><td class="down sortable bar" id="b" onclick="toggleSort(this)">Missed Instructions</td><td class="sortable ctr2" id="c" onclick="toggleSort(this)">Cov.</td><td class="sortable bar" id="d" onclick="toggleSort(this)">Missed Branches</td><td class="sortable ctr2" id="e" onclick="toggleSort(this)">Cov.</td><td class="sortable ctr1" id="f" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="g" onclick="toggleSort(this)">Cxty</td><td class="sortable ctr1" id="h" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="i" onclick="toggleSort(this)">Lines</td><td class="sortable ctr1" id="j" onclick="toggleSort(this)">Missed</td><td class="sortable ctr2" id="k" onclick="toggleSort(this)">Methods</td></tr></thead><tfoot><tr><td>Total</td><td class="bar">0 of 347</td><td class="ctr2">100%</td><td class="bar">0 of 47</td><td class="ctr2">100%</td><td class="ctr1">0</td><td class="ctr2">45</td><td class="ctr
1">0</td><td class="ctr2">95</td><td class="ctr1">0</td><td class="ctr2">21</td></tr></tfoot><tbody><tr><td id="a8"><a href="CSVPrinter.java.html#L223" class="el_method">printComment(String)</a></td><td class="bar" id="b0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="77" alt="77"/></td><td class="ctr2" id="c0">100%</td><td class="bar" id="d0"><img src="../jacoco-resources/greenbar.gif" width="120" height="10" title="15" alt="15"/></td><td class="ctr2" id="e0">100%</td><td class="ctr1" id="f0">0</td><td class="ctr2" id="g0">9</td><td class="ctr1" id="h0">0</td><td class="ctr2" id="i0">18</td><td class="ctr1" id="j0">0</td><td class="ctr2" id="k0">1</td></tr><tr><td id="a2"><a href="CSVPrinter.java.html#L87" class="el_method">CSVPrinter(Appendable, CSVFormat)</a></td><td class="bar" id="b1"><img src="../jacoco-resources/greenbar.gif" width="87" height="10" title="56" alt="56"/></td><td class="ctr2" id="c1">100%</td><td class="bar" id="d2"><img src="../jac
oco-resources/greenbar.gif" width="64" height="10" title="8" alt="8"/></td><td class="ctr2" id="e1">100%</td><td class="ctr1" id="f1">0</td><td class="ctr2" id="g2">5</td><td class="ctr1" id="h1">0</td><td class="ctr2" id="i1">13</td><td class="ctr1" id="j1">0</td><td class="ctr2" id="k1">1</td></tr><tr><td id="a18"><a href="CSVPrinter.java.html#L445" class="el_method">printRecords(ResultSet)</a></td><td class="bar" id="b2"><img src="../jacoco-resources/greenbar.gif" width="84" height="10" title="54" alt="54"/></td><td class="ctr2" id="c2">100%</td><td class="bar" id="d1"><img src="../jacoco-resources/greenbar.gif" width="80" height="10" title="10" alt="10"/></td><td class="ctr2" id="e2">100%</td><td class="ctr1" id="f2">0</td><td class="ctr2" id="g1">6</td><td class="ctr1" id="h2">0</td><td class="ctr2" id="i2">13</td><td class="ctr1" id="j2">0</td><td class="ctr2" id="k2">1</td></tr><tr><td id="a14"><a href="CSVPrinter.java.html#L335" class="el_method">printRecordObject(Object)</a
></td><td class="bar" id="b3"><img src="../jacoco-resources/greenbar.gif" width="38" height="10" title="25" alt="25"/></td><td class="ctr2" id="c3">100%</td><td class="bar" id="d4"><img src="../jacoco-resources/greenbar.gif" width="32" height="10" title="4" alt="4"/></td><td class="ctr2" id="e3">100%</td><td class="ctr1" id="f3">0</td><td class="ctr2" id="g4">3</td><td class="ctr1" id="h3">0</td><td class="ctr2" id="i3">6</td><td class="ctr1" id="j3">0</td><td class="ctr2" id="k3">1</td></tr><tr><td id="a1"><a href="CSVPrinter.java.html#L137" class="el_method">close(boolean)</a></td><td class="bar" id="b4"><img src="../jacoco-resources/greenbar.gif" width="26" height="10" title="17" alt="17"/></td><td class="ctr2" id="c4">100%</td><td class="bar" id="d3"><img src="../jacoco-resources/greenbar.gif" width="48" height="10" title="6" alt="6"/></td><td class="ctr2" id="e4">100%</td><td class="ctr1" id="f4">0</td><td class="ctr2" id="g3">4</td><td class="ctr1" id="h4">0</td><td class="ctr
2" id="i4">5</td><td class="ctr1" id="j4">0</td><td class="ctr2" id="k4">1</td></tr><tr><td id="a9"><a href="CSVPrinter.java.html#L261" class="el_method">printHeaders(ResultSet)</a></td><td class="bar" id="b5"><img src="../jacoco-resources/greenbar.gif" width="24" height="10" title="16" alt="16"/></td><td class="ctr2" id="c5">100%</td><td class="bar" id="d7"/><td class="ctr2" id="e7">n/a</td><td class="ctr1" id="f5">0</td><td class="ctr2" id="g7">1</td><td class="ctr1" id="h5">0</td><td class="ctr2" id="i5">4</td><td class="ctr1" id="j5">0</td><td class="ctr2" id="k5">1</td></tr><tr><td id="a7"><a href="CSVPrinter.java.html#L197" class="el_method">print(Object)</a></td><td class="bar" id="b6"><img src="../jacoco-resources/greenbar.gif" width="18" height="10" title="12" alt="12"/></td><td class="ctr2" id="c6">100%</td><td class="bar" id="d8"/><td class="ctr2" id="e8">n/a</td><td class="ctr1" id="f6">0</td><td class="ctr2" id="g8">1</td><td class="ctr1" id="h6">0</td><td class="ctr2"
id="i7">3</td><td class="ctr1" id="j6">0</td><td class="ctr2" id="k6">1</td></tr><tr><td id="a3"><a href="CSVPrinter.java.html#L152" class="el_method">endOfRecord()</a></td><td class="bar" id="b7"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c7">100%</td><td class="bar" id="d9"/><td class="ctr2" id="e9">n/a</td><td class="ctr1" id="f7">0</td><td class="ctr2" id="g9">1</td><td class="ctr1" id="h7">0</td><td class="ctr2" id="i8">3</td><td class="ctr1" id="j7">0</td><td class="ctr2" id="k7">1</td></tr><tr><td id="a4"><a href="CSVPrinter.java.html#L164" class="el_method">flush()</a></td><td class="bar" id="b8"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c8">100%</td><td class="bar" id="d5"><img src="../jacoco-resources/greenbar.gif" width="16" height="10" title="2" alt="2"/></td><td class="ctr2" id="e5">100%</td><td class="ctr1" id="f8">0</td><td class="
ctr2" id="g5">2</td><td class="ctr1" id="h8">0</td><td class="ctr2" id="i9">3</td><td class="ctr1" id="j8">0</td><td class="ctr2" id="k8">1</td></tr><tr><td id="a10"><a href="CSVPrinter.java.html#L274" class="el_method">println()</a></td><td class="bar" id="b9"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c9">100%</td><td class="bar" id="d10"/><td class="ctr2" id="e10">n/a</td><td class="ctr1" id="f9">0</td><td class="ctr2" id="g10">1</td><td class="ctr1" id="h9">0</td><td class="ctr2" id="i10">3</td><td class="ctr1" id="j9">0</td><td class="ctr2" id="k9">1</td></tr><tr><td id="a19"><a href="CSVPrinter.java.html#L479" class="el_method">printRecords(ResultSet, boolean)</a></td><td class="bar" id="b10"><img src="../jacoco-resources/greenbar.gif" width="14" height="10" title="9" alt="9"/></td><td class="ctr2" id="c10">100%</td><td class="bar" id="d6"><img src="../jacoco-resources/greenbar.gif" width="16" height="10" tit
le="2" alt="2"/></td><td class="ctr2" id="e6">100%</td><td class="ctr1" id="f10">0</td><td class="ctr2" id="g6">2</td><td class="ctr1" id="h10">0</td><td class="ctr2" id="i6">4</td><td class="ctr1" id="j10">0</td><td class="ctr2" id="k10">1</td></tr><tr><td id="a11"><a href="CSVPrinter.java.html#L293" class="el_method">printRecord(Iterable)</a></td><td class="bar" id="b11"><img src="../jacoco-resources/greenbar.gif" width="12" height="10" title="8" alt="8"/></td><td class="ctr2" id="c11">100%</td><td class="bar" id="d11"/><td class="ctr2" id="e11">n/a</td><td class="ctr1" id="f11">0</td><td class="ctr2" id="g11">1</td><td class="ctr1" id="h11">0</td><td class="ctr2" id="i11">3</td><td class="ctr1" id="j11">0</td><td class="ctr2" id="k11">1</td></tr><tr><td id="a13"><a href="CSVPrinter.java.html#L330" class="el_method">printRecord(Stream)</a></td><td class="bar" id="b12"><img src="../jacoco-resources/greenbar.gif" width="12" height="10" title="8" alt="8"/></td><td class="ctr2" id="c1
2">100%</td><td class="bar" id="d12"/><td class="ctr2" id="e12">n/a</td><td class="ctr1" id="f12">0</td><td class="ctr2" id="g12">1</td><td class="ctr1" id="h12">0</td><td class="ctr2" id="i12">3</td><td class="ctr1" id="j12">0</td><td class="ctr2" id="k12">1</td></tr><tr><td id="a15"><a href="CSVPrinter.java.html#L346" class="el_method">printRecords(IOStream)</a></td><td class="bar" id="b13"><img src="../jacoco-resources/greenbar.gif" width="12" height="10" title="8" alt="8"/></td><td class="ctr2" id="c13">100%</td><td class="bar" id="d13"/><td class="ctr2" id="e13">n/a</td><td class="ctr1" id="f13">0</td><td class="ctr2" id="g13">1</td><td class="ctr1" id="h13">0</td><td class="ctr2" id="i13">2</td><td class="ctr1" id="j13">0</td><td class="ctr2" id="k13">1</td></tr><tr><td id="a12"><a href="CSVPrinter.java.html#L311" class="el_method">printRecord(Object[])</a></td><td class="bar" id="b14"><img src="../jacoco-resources/greenbar.gif" width="7" height="10" title="5" alt="5"/></td><t
d class="ctr2" id="c14">100%</td><td class="bar" id="d14"/><td class="ctr2" id="e14">n/a</td><td class="ctr1" id="f14">0</td><td class="ctr2" id="g14">1</td><td class="ctr1" id="h14">0</td><td class="ctr2" id="i14">2</td><td class="ctr1" id="j14">0</td><td class="ctr2" id="k14">1</td></tr><tr><td id="a16"><a href="CSVPrinter.java.html#L389" class="el_method">printRecords(Iterable)</a></td><td class="bar" id="b15"><img src="../jacoco-resources/greenbar.gif" width="7" height="10" title="5" alt="5"/></td><td class="ctr2" id="c15">100%</td><td class="bar" id="d15"/><td class="ctr2" id="e15">n/a</td><td class="ctr1" id="f15">0</td><td class="ctr2" id="g15">1</td><td class="ctr1" id="h15">0</td><td class="ctr2" id="i15">2</td><td class="ctr1" id="j15">0</td><td class="ctr2" id="k15">1</td></tr><tr><td id="a17"><a href="CSVPrinter.java.html#L430" class="el_method">printRecords(Object[])</a></td><td class="bar" id="b16"><img src="../jacoco-resources/greenbar.gif" width="7" height="10" title
="5" alt="5"/></td><td class="ctr2" id="c16">100%</td><td class="bar" id="d16"/><td class="ctr2" id="e16">n/a</td><td class="ctr1" id="f16">0</td><td class="ctr2" id="g16">1</td><td class="ctr1" id="h16">0</td><td class="ctr2" id="i16">2</td><td class="ctr1" id="j16">0</td><td class="ctr2" id="k16">1</td></tr><tr><td id="a20"><a href="CSVPrinter.java.html#L527" class="el_method">printRecords(Stream)</a></td><td class="bar" id="b17"><img src="../jacoco-resources/greenbar.gif" width="7" height="10" title="5" alt="5"/></td><td class="ctr2" id="c17">100%</td><td class="bar" id="d17"/><td class="ctr2" id="e17">n/a</td><td class="ctr1" id="f17">0</td><td class="ctr2" id="g17">1</td><td class="ctr1" id="h17">0</td><td class="ctr2" id="i17">2</td><td class="ctr1" id="j17">0</td><td class="ctr2" id="k17">1</td></tr><tr><td id="a0"><a href="CSVPrinter.java.html#L124" class="el_method">close()</a></td><td class="bar" id="b18"><img src="../jacoco-resources/greenbar.gif" width="6" height="10" ti
tle="4" alt="4"/></td><td class="ctr2" id="c18">100%</td><td class="bar" id="d18"/><td class="ctr2" id="e18">n/a</td><td class="ctr1" id="f18">0</td><td class="ctr2" id="g18">1</td><td class="ctr1" id="h18">0</td><td class="ctr2" id="i18">2</td><td class="ctr1" id="j18">0</td><td class="ctr2" id="k18">1</td></tr><tr><td id="a5"><a href="CSVPrinter.java.html#L175" class="el_method">getOut()</a></td><td class="bar" id="b19"><img src="../jacoco-resources/greenbar.gif" width="4" height="10" title="3" alt="3"/></td><td class="ctr2" id="c19">100%</td><td class="bar" id="d19"/><td class="ctr2" id="e19">n/a</td><td class="ctr1" id="f19">0</td><td class="ctr2" id="g19">1</td><td class="ctr1" id="h19">0</td><td class="ctr2" id="i19">1</td><td class="ctr1" id="j19">0</td><td class="ctr2" id="k19">1</td></tr><tr><td id="a6"><a href="CSVPrinter.java.html#L185" class="el_method">getRecordCount()</a></td><td class="bar" id="b20"><img src="../jacoco-resources/greenbar.gif" width="4" height="10" tit
le="3" alt="3"/></td><td class="ctr2" id="c20">100%</td><td class="bar" id="d20"/><td class="ctr2" id="e20">n/a</td><td class="ctr1" id="f20">0</td><td class="ctr2" id="g20">1</td><td class="ctr1" id="h20">0</td><td class="ctr2" id="i20">1</td><td class="ctr1" id="j20">0</td><td class="ctr2" id="k20">1</td></tr></tbody></table><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.12.202403310830</span></div></body></html>
\ No newline at end of file