Explicit unboxing; associated Javadoc

git-svn-id: https://svn.apache.org/repos/asf/commons/proper/csv/trunk@1398365 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Sebastian Bazley 2012-10-15 16:27:25 +00:00
parent 33c004f525
commit 3a90cfe249
1 changed files with 11 additions and 5 deletions

View File

@ -67,7 +67,7 @@ public class CSVPrinter implements Flushable, Closeable {
// ====================================================== // ======================================================
/** /**
* Outputs a the line separator. * Outputs the line separator.
*/ */
public void println() throws IOException { public void println() throws IOException {
out.append(format.getLineSeparator()); out.append(format.getLineSeparator());
@ -130,7 +130,7 @@ public class CSVPrinter implements Flushable, Closeable {
if (!newLine) { if (!newLine) {
println(); println();
} }
out.append(format.getCommentStart()); out.append(format.getCommentStart().charValue());
out.append(SP); out.append(SP);
for (int i = 0; i < comment.length(); i++) { for (int i = 0; i < comment.length(); i++) {
final char c = comment.charAt(i); final char c = comment.charAt(i);
@ -142,7 +142,7 @@ public class CSVPrinter implements Flushable, Closeable {
//$FALL-THROUGH$ break intentionally excluded. //$FALL-THROUGH$ break intentionally excluded.
case LF: case LF:
println(); println();
out.append(format.getCommentStart()); out.append(format.getCommentStart().charValue());
out.append(SP); out.append(SP);
break; break;
default: default:
@ -172,6 +172,9 @@ public class CSVPrinter implements Flushable, Closeable {
} }
} }
/*
* Note: must only be called if escaping is enabled, otherwise will generate NPE
*/
void printAndEscape(final CharSequence value, final int offset, final int len) throws IOException { void printAndEscape(final CharSequence value, final int offset, final int len) throws IOException {
int start = offset; int start = offset;
int pos = offset; int pos = offset;
@ -180,7 +183,7 @@ public class CSVPrinter implements Flushable, Closeable {
printDelimiter(); printDelimiter();
final char delim = format.getDelimiter(); final char delim = format.getDelimiter();
final char escape = format.getEscape(); final char escape = format.getEscape().charValue();
while (pos < end) { while (pos < end) {
char c = value.charAt(pos); char c = value.charAt(pos);
@ -210,6 +213,9 @@ public class CSVPrinter implements Flushable, Closeable {
} }
} }
/*
* Note: must only be called if quoting is enabled, otherwise will generate NPE
*/
void printAndQuote(Object object, final CharSequence value, final int offset, final int len) throws IOException { void printAndQuote(Object object, final CharSequence value, final int offset, final int len) throws IOException {
final boolean first = newLine; // is this the first value on this line? final boolean first = newLine; // is this the first value on this line?
boolean quote = false; boolean quote = false;
@ -220,7 +226,7 @@ public class CSVPrinter implements Flushable, Closeable {
printDelimiter(); printDelimiter();
final char delimChar = format.getDelimiter(); final char delimChar = format.getDelimiter();
final char quoteChar = format.getQuoteChar(); final char quoteChar = format.getQuoteChar().charValue();
Quote quotePolicy = format.getQuotePolicy(); Quote quotePolicy = format.getQuotePolicy();
if (quotePolicy == null) { if (quotePolicy == null) {