fuzzycsv.IgnoreNewLineCSVWriter.groovy Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of fuzzy-csv Show documentation
Show all versions of fuzzy-csv Show documentation
A groovy/java tabular Data (from CSV,SQL,JSON) processing library that supports fuzzy column matching,tranformations/merging/querying etc
package fuzzycsv
/**
* Created by kay on 11/30/2016.
*/
class IgnoreNewLineCSVWriter extends FuzzyCSVWriter {
public static final char LINE_END = '\n'
public static final char LINE_RETURN = '\r'
/**
* Constructs CSVWriter using a comma for the separator.
*
* @param writer
* the writer to an underlying CSV source.
*/
IgnoreNewLineCSVWriter(Writer writer) {
super(writer)
}
@Override
protected void processCharacter(Appendable appendable, char nextChar) throws IOException {
if (nextChar == LINE_END || nextChar == LINE_RETURN) return
super.processCharacter(appendable, nextChar)
}
static writeTo(Writer w, List csv) {
new IgnoreNewLineCSVWriter(w).writeAll(csv)
}
}