Standardise on record rather than line; fix incorrect Javadoc comments
git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1468827 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
939a8a04eb
commit
6640e8597c
|
@ -40,8 +40,8 @@ public class CSVPrinter implements Flushable, Closeable {
|
||||||
private final Appendable out;
|
private final Appendable out;
|
||||||
private final CSVFormat format;
|
private final CSVFormat format;
|
||||||
|
|
||||||
/** True if we just began a new line. */
|
/** True if we just began a new record. */
|
||||||
private boolean newLine = true;
|
private boolean newRecord = true;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a printer that will print values to the given stream following the CSVFormat.
|
* Creates a printer that will print values to the given stream following the CSVFormat.
|
||||||
|
@ -66,14 +66,14 @@ public class CSVPrinter implements Flushable, Closeable {
|
||||||
// ======================================================
|
// ======================================================
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Outputs the line separator.
|
* Outputs the record separator.
|
||||||
*
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
* If an I/O error occurs
|
* If an I/O error occurs
|
||||||
*/
|
*/
|
||||||
public void println() throws IOException {
|
public void println() throws IOException {
|
||||||
out.append(format.getRecordSeparator());
|
out.append(format.getRecordSeparator());
|
||||||
newLine = true;
|
newRecord = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -136,7 +136,7 @@ public class CSVPrinter implements Flushable, Closeable {
|
||||||
if (!format.isCommentingEnabled()) {
|
if (!format.isCommentingEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!newLine) {
|
if (!newRecord) {
|
||||||
println();
|
println();
|
||||||
}
|
}
|
||||||
out.append(format.getCommentStart().charValue());
|
out.append(format.getCommentStart().charValue());
|
||||||
|
@ -175,8 +175,8 @@ public class CSVPrinter implements Flushable, Closeable {
|
||||||
}
|
}
|
||||||
|
|
||||||
void printDelimiter() throws IOException {
|
void printDelimiter() throws IOException {
|
||||||
if (newLine) {
|
if (newRecord) {
|
||||||
newLine = false;
|
newRecord = false;
|
||||||
} else {
|
} else {
|
||||||
out.append(format.getDelimiter());
|
out.append(format.getDelimiter());
|
||||||
}
|
}
|
||||||
|
@ -228,7 +228,7 @@ public class CSVPrinter implements Flushable, Closeable {
|
||||||
*/
|
*/
|
||||||
void printAndQuote(final Object object, final CharSequence value,
|
void printAndQuote(final Object object, final CharSequence value,
|
||||||
final int offset, final int len) throws IOException {
|
final int offset, final int len) throws IOException {
|
||||||
final boolean first = newLine; // is this the first value on this line?
|
final boolean first = newRecord; // is this the first value on this line?
|
||||||
boolean quote = false;
|
boolean quote = false;
|
||||||
int start = offset;
|
int start = offset;
|
||||||
int pos = offset;
|
int pos = offset;
|
||||||
|
|
Loading…
Reference in New Issue