Class DatevUnivocityWriters
DatevFile.
datev-exporter-advanced writes DATEV files on its own and pulls in no third-party
dependencies. This class exists for applications that already route their CSV output through
Univocity and want a CsvWriter that agrees with DATEV's quoting, delimiter, line
separator and charset rules:
CsvWriter writer = DatevUnivocityWriters.newCsvWriter(file, outputStream);
DatevUnivocityWriters.writeTo(file, writer);
A CsvWriter emits one uniformly shaped record type and therefore cannot produce the
differently shaped 31-field EXTF management record. writeTo(DatevFile, CsvWriter)
refuses a file that carries metadata; use DatevFile.writeTo(OutputStream) for a complete
file, or writeDataTo(DatevFile, CsvWriter) when only the heading and booking rows are
intended.
-
Method Summary
Modifier and TypeMethodDescriptionstatic com.univocity.parsers.csv.CsvWriterSettingscsvWriterSettings(io.github.mrtyldr.datev.advanced.DatevFile file) Creates a fresh Univocity configuration for a file.static com.univocity.parsers.csv.CsvWriternewCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, OutputStream output) Creates a configured writer using the file's charset.static com.univocity.parsers.csv.CsvWriternewCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, OutputStream output, com.univocity.parsers.csv.CsvWriterSettings settings) Creates a writer with caller-customized settings while retaining strict charset handling and caller ownership of the output stream.static com.univocity.parsers.csv.CsvWriternewCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, Writer output) Creates a configured writer around a caller-provided character writer.static com.univocity.parsers.csv.CsvWriternewCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, Writer output, com.univocity.parsers.csv.CsvWriterSettings settings) Creates a writer around a caller-provided character writer and customized settings.static voidwriteDataTo(io.github.mrtyldr.datev.advanced.DatevFile file, com.univocity.parsers.csv.CsvWriter writer) Writes only the DATEV heading and booking rows through a caller-provided writer.static voidwriteTo(io.github.mrtyldr.datev.advanced.DatevFile file, com.univocity.parsers.csv.CsvWriter writer) Writes a data-only file to a fresh, compatibly configured writer and flushes it.
-
Method Details
-
csvWriterSettings
public static com.univocity.parsers.csv.CsvWriterSettings csvWriterSettings(io.github.mrtyldr.datev.advanced.DatevFile file) Creates a fresh Univocity configuration for a file.The returned settings may be customized without affecting the file. A fresh
CsvWriterwrites the configured heading automatically before its first data row; for an empty file callAbstractWriter.writeHeaders()explicitly. These settings describe only the heading and booking-row section.- Parameters:
file- the file whose header and quoting rules apply- Returns:
- a fresh writer configuration
-
newCsvWriter
public static com.univocity.parsers.csv.CsvWriter newCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, OutputStream output) Creates a configured writer using the file's charset.Unmappable characters are reported instead of being silently replaced. Closing the returned writer flushes but does not close the supplied stream.
- Parameters:
file- the file whose header and charset applyoutput- the caller-owned output stream- Returns:
- a configured writer that writes to
output
-
newCsvWriter
public static com.univocity.parsers.csv.CsvWriter newCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, OutputStream output, com.univocity.parsers.csv.CsvWriterSettings settings) Creates a writer with caller-customized settings while retaining strict charset handling and caller ownership of the output stream.- Parameters:
file- the file whose charset appliesoutput- the caller-owned output streamsettings- the writer settings to use- Returns:
- a writer that writes to
outputusingsettings
-
newCsvWriter
public static com.univocity.parsers.csv.CsvWriter newCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, Writer output) Creates a configured writer around a caller-provided character writer.- Parameters:
file- the file whose header and quoting rules applyoutput- the caller-owned character writer- Returns:
- a configured writer that writes to
output
-
newCsvWriter
public static com.univocity.parsers.csv.CsvWriter newCsvWriter(io.github.mrtyldr.datev.advanced.DatevFile file, Writer output, com.univocity.parsers.csv.CsvWriterSettings settings) Creates a writer around a caller-provided character writer and customized settings.- Parameters:
file- the file whose header appliesoutput- the caller-owned character writersettings- the writer settings to use- Returns:
- a writer that writes to
outputusingsettings
-
writeTo
public static void writeTo(io.github.mrtyldr.datev.advanced.DatevFile file, com.univocity.parsers.csv.CsvWriter writer) Writes a data-only file to a fresh, compatibly configured writer and flushes it.The writer is not closed. It must not already contain records and should have been created from
csvWriterSettings(DatevFile).- Parameters:
file- the file to writewriter- the fresh, compatibly configured destination writer- Throws:
IllegalStateException- if the file carries EXTF metadata
-
writeDataTo
public static void writeDataTo(io.github.mrtyldr.datev.advanced.DatevFile file, com.univocity.parsers.csv.CsvWriter writer) Writes only the DATEV heading and booking rows through a caller-provided writer.This deliberately omits the EXTF management record even when metadata is configured. The writer is flushed but not closed.
- Parameters:
file- the file to writewriter- the fresh, compatibly configured destination writer
-