All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fuzzycsv.FuzzyCSVWriter.groovy Maven / Gradle / Ivy

Go to download

A groovy/java tabular Data (from CSV,SQL,JSON) processing library that supports fuzzy column matching,tranformations/merging/querying etc

There is a newer version: 1.9.1-groovy4
Show newest version
package fuzzycsv

import com.opencsv.CSVWriter
import groovy.transform.CompileStatic


/**
 * Simple CSV Writer from which allows writing List
 */
@CompileStatic
class FuzzyCSVWriter extends CSVWriter {

    Writer writer
    /**
     *  Constructs CSVWriter using a comma for the separator.
     *
     * @param writer
     *             the writer to an underlying CSV source.
     */
    FuzzyCSVWriter(Writer writer) {
        super(writer)
        this.writer = writer
    }

    @Override
    void writeAll(List allLines) {
        for (Iterator iter = allLines.iterator(); iter.hasNext();) {
            String[] line = iter.next() as String[]
            writeNext(line)
        }
        writer.flush()
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy