java.lang.Object
io.xlate.edi.stream.PropertySupport
io.xlate.edi.stream.EDIOutputFactory
Defines an abstract implementation of a factory for getting EDIStreamWriters
and XMLStreamWriters (wrapping an existing EDIStreamWriter). An EDIOutputErrorReporter
may also be configured via the factory for use with each new EDIStreamWriter
created.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringWhen set to true and a schema has been provided, elements written to the output will be padded to the minimum length required by the schema.static final StringWhen set to true, the EDI output will have a platform specific line separator written after each segment terminator.static final StringWhen set to true, empty trailing elements in a segment and empty trailing components in a composite element will be truncated.Fields inherited from class io.xlate.edi.stream.PropertySupport
properties, supportedProperties -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract EDIStreamWritercreateEDIStreamWriter(OutputStream stream) Create a new EDIStreamWriter that writes to a streamabstract EDIStreamWritercreateEDIStreamWriter(OutputStream stream, String encoding) Create a new EDIStreamWriter that writes to a streamabstract XMLStreamWritercreateXMLStreamWriter(EDIStreamWriter writer) Creates a newXMLStreamWriterthat uses the given writer as its output.abstract EDIOutputErrorReporterRetrieves the reporter that will be set on any EDIStreamWriter created by this factory instance.static EDIOutputFactoryCreate a new instance of the factory.abstract voidsetErrorReporter(EDIOutputErrorReporter reporter) The reporter that will be set on any EDIStreamWriter created by this factory instance.Methods inherited from class io.xlate.edi.stream.PropertySupport
getProperty, isPropertySupported, setProperty
-
Field Details
-
PRETTY_PRINT
When set to true, the EDI output will have a platform specific line separator written after each segment terminator.
Default value is false.
- See Also:
-
TRUNCATE_EMPTY_ELEMENTS
When set to true, empty trailing elements in a segment and empty trailing components in a composite element will be truncated. I.e, they will not be written to the output.
Default value is false.
- See Also:
-
FORMAT_ELEMENTS
When set to true and a schema has been provided, elements written to the output will be padded to the minimum length required by the schema.
Default value is false.
- Since:
- 1.11
- See Also:
-
-
Constructor Details
-
EDIOutputFactory
protected EDIOutputFactory()Default constructor
-
-
Method Details
-
newFactory
Create a new instance of the factory. This static method creates a new factory instance. Once an application has obtained a reference to an EDIOutputFactory it can use the factory to configure and obtain stream instances.- Returns:
- the factory implementation
-
createEDIStreamWriter
Create a new EDIStreamWriter that writes to a stream- Parameters:
stream-OutputStreamto which the EDI data will be written- Returns:
- the writer instance
-
createEDIStreamWriter
public abstract EDIStreamWriter createEDIStreamWriter(OutputStream stream, String encoding) throws EDIStreamException Create a new EDIStreamWriter that writes to a stream- Parameters:
stream-OutputStreamto which the EDI data will be writtenencoding- character encoding of the stream, must be a validCharset.- Returns:
- the writer instance
- Throws:
EDIStreamException- when encoding is not supported
-
createXMLStreamWriter
Creates a newXMLStreamWriterthat uses the given writer as its output. XML Elements written to the writer must use the namespaces declared by the constants inEDINamespaces. The sequence of elements is critical and must align with the structure of the intended EDI output to be written via the given EDI writer.- Parameters:
writer- the writer used to generate EDI output using the XML writer- Returns:
- a new
XMLStreamWriter
-
getErrorReporter
Retrieves the reporter that will be set on any EDIStreamWriter created by this factory instance.- Returns:
- the reporter that will be set on any EDIStreamWriter created by this factory instance
- Since:
- 1.9
-
setErrorReporter
The reporter that will be set on any EDIStreamWriter created by this factory instance. NOTE: When using an EDIOutputErrorReporter, errors found in the data stream that are reported to the reporter will not be throw as instances ofEDIValidationException.- Parameters:
reporter- the resolver to use to report non fatal errors- Since:
- 1.9
-