Skip to content
This repository has been archived by the owner on Jan 22, 2019. It is now read-only.

Commit

Permalink
work on #40
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed May 16, 2014
1 parent 2ce5d2c commit 4ad7d63
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 613 deletions.
1 change: 1 addition & 0 deletions release-notes/VERSION
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ Version: 2.3.4 (xx-xxx-2014)

#38: Extra column delimiter added when column is escaped and follows empty column
(reported by Paul M, Magrath@github)
- Allow sub-classing of `CsvWriter`

------------------------------------------------------------------------
=== History: ===
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,18 @@ private Feature(boolean defaultState) {
public CsvGenerator(IOContext ctxt, int jsonFeatures, int csvFeatures,
ObjectCodec codec, Writer out,
char columnSeparator, char quoteChar, char[] linefeed)
{
this(ctxt, jsonFeatures, csvFeatures, codec,
new CsvWriter(ctxt, out, columnSeparator, quoteChar, linefeed));
}

public CsvGenerator(IOContext ctxt, int jsonFeatures, int csvFeatures,
ObjectCodec codec, CsvWriter csvWriter)
{
super(jsonFeatures, codec);
_ioContext = ctxt;
_csvFeatures = csvFeatures;
_writer = new CsvWriter(ctxt, out, columnSeparator, quoteChar, linefeed);
_writer = csvWriter;
}

/*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
* Low-level helper class that handles actual output of CSV, purely
* based on indexes given without worrying about reordering etc.
*/
public final class CsvWriter
public class CsvWriter
{
/* As an optimization we try coalescing short writes into
* buffer; but pass longer directly.
Expand Down Expand Up @@ -568,7 +568,7 @@ public void close(boolean autoClose) throws IOException
* Helper method that determines whether given String is likely
* to require quoting; check tries to optimize for speed.
*/
protected final boolean _mayNeedQuotes(String value, int length)
protected boolean _mayNeedQuotes(String value, int length)
{
// let's not bother checking long Strings, just quote already:
if (length > MAX_QUOTE_CHECK) {
Expand Down
Loading

0 comments on commit 4ad7d63

Please sign in to comment.