Package io.github.mrtyldr.datev.plain
Class DatevStreamWriter.Builder
java.lang.Object
io.github.mrtyldr.datev.plain.DatevStreamWriter.Builder
- Enclosing class:
- DatevStreamWriter
Configures a streaming writer, including the optional EXTF management record.
The static factories cover the common cases; this builder exists so schema, validator and
metadata can be combined without a factory per combination. Nothing is written until one of
the build methods is called. Instances are not thread-safe.
-
Method Summary
Modifier and TypeMethodDescriptionbuild(OutputStream output) Starts a writer on a caller-owned byte stream, emitting Windows-1252 directly.Starts a writer on a caller-owned character writer.metadata(io.github.mrtyldr.datev.core.DatevMetadata metadata) Sets the EXTF management record written before the heading.validator(BiConsumer<Integer, List<String>> validator) Sets the optional row validator.
-
Method Details
-
validator
Sets the optional row validator.- Parameters:
validator- receives the format version and each immutable aligned row- Returns:
- this builder
-
metadata
Sets the EXTF management record written before the heading.- Parameters:
metadata- the management record- Returns:
- this builder
- Throws:
IllegalArgumentException- if the metadata's format version differs from the schema
-
build
Starts a writer on a caller-owned byte stream, emitting Windows-1252 directly.- Parameters:
output- the caller-owned destination stream- Returns:
- a new writer that has already written its leading records
-
build
Starts a writer on a caller-owned character writer.- Parameters:
output- the caller-owned destination writer- Returns:
- a new writer that has already written its leading records
-