-
- All Superinterfaces:
AutoCloseable
public interface EDIStreamWriter extends AutoCloseable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Close this writer and free any resources associated with the writer.EDIStreamWriter
endComponent()
EDIStreamWriter
endElement()
EDIStreamWriter
endInterchange()
void
flush()
Write any cached data to the underlying output mechanism.Schema
getControlSchema()
Returns the control schema currently set on the reader.Map<String,Character>
getDelimiters()
Retrieve a read-only map of delimiters in use for the stream being written.Location
getLocation()
Return the current location of the writer.Object
getProperty(String name)
Get the value of a feature/property from the underlying implementationString
getStandard()
Get the EDI standard name.void
setControlSchema(Schema controlSchema)
Sets the schema to be used for validation of the control structure for this stream writer.void
setTransactionSchema(Schema transactionSchema)
Sets the schema to be used for validation of the business transaction for this stream writer.EDIStreamWriter
startComponent()
EDIStreamWriter
startInterchange()
EDIStreamWriter
writeBinaryData(byte[] text, int start, int end)
EDIStreamWriter
writeBinaryData(InputStream stream)
EDIStreamWriter
writeBinaryData(ByteBuffer buffer)
EDIStreamWriter
writeComponent(char[] text, int start, int end)
EDIStreamWriter
writeComponent(CharSequence text)
EDIStreamWriter
writeElement(char[] text, int start, int end)
EDIStreamWriter
writeElement(CharSequence text)
EDIStreamWriter
writeElementData(char[] text, int start, int end)
EDIStreamWriter
writeElementData(CharSequence text)
EDIStreamWriter
writeEmptyComponent()
EDIStreamWriter
writeEmptyElement()
EDIStreamWriter
writeEndSegment()
EDIStreamWriter
writeRepeatElement()
EDIStreamWriter
writeStartElement()
EDIStreamWriter
writeStartElementBinary()
EDIStreamWriter
writeStartSegment(String name)
-
-
-
Method Detail
-
getProperty
Object getProperty(String name)
Get the value of a feature/property from the underlying implementation- Parameters:
name
- - The name of the property, may not be null- Returns:
- The value of the property
- Throws:
IllegalArgumentException
- if name is null
-
close
void close() throws EDIStreamException
Close this writer and free any resources associated with the writer. This must not close the underlying output stream.- Specified by:
close
in interfaceAutoCloseable
- Throws:
EDIStreamException
- if there are errors freeing associated resources
-
flush
void flush() throws EDIStreamException
Write any cached data to the underlying output mechanism.- Throws:
EDIStreamException
- if there are errors flushing the cache
-
getControlSchema
Schema getControlSchema()
Returns the control schema currently set on the reader. If none has been set, then null will be returned.- Returns:
- the control schema current set on this reader, may be null
- Since:
- 1.8
-
setControlSchema
void setControlSchema(Schema controlSchema)
Sets the schema to be used for validation of the control structure for this stream writer. This schema will be used to validate interchange, group, and transaction/message envelopes.
Calls to this method are only valid before the interchange is started.
A built-in control schema may be obtained from
SchemaFactory#getControlSchema
to pass to this method.- Parameters:
controlSchema
- the schema instance to use for validation of control structures- Throws:
IllegalStateException
- when the writer is not in its initial state- Since:
- 1.1
- See Also:
SchemaFactory#getControlSchema
-
setTransactionSchema
void setTransactionSchema(Schema transactionSchema)
Sets the schema to be used for validation of the business transaction for this stream writer. This schema will be used to validate only the contents of a transaction/message, not including the begin/end control structures.
This method may be called at any time. However, when non-null, the writer will make use of the transaction schema for output validation. It is the responsibility of the caller to set the transaction schema to null at the end of the business transaction.
- Parameters:
transactionSchema
- the schema instance to use for validation of business transaction structures- Since:
- 1.1
-
getLocation
Location getLocation()
Return the current location of the writer. If the Location is unknown the processor should return an implementation of Location that returns -1 for the location values. The location information is only valid until the next item is written to the output.- Returns:
- current location of the writer
- Since:
- 1.1
-
getStandard
String getStandard()
Get the EDI standard name. Calls to this method are only valid when the interchange type has been determined, after the full interchange header segment has been written.- Returns:
- the name of the EDI standard
- Throws:
IllegalStateException
- when the standard has not yet been determined, prior to the start of an interchange header segment being fully written- Since:
- 1.7
-
getDelimiters
Map<String,Character> getDelimiters()
Retrieve a read-only map of delimiters in use for the stream being written.- Returns:
- The value of the property
- Throws:
IllegalStateException
- when the standard has not yet been determined, prior to the start of an interchange header segment being fully written- Since:
- 1.8
-
startInterchange
EDIStreamWriter startInterchange() throws EDIStreamException
- Throws:
EDIStreamException
-
endInterchange
EDIStreamWriter endInterchange() throws EDIStreamException
- Throws:
EDIStreamException
-
writeStartSegment
EDIStreamWriter writeStartSegment(String name) throws EDIStreamException
- Throws:
EDIStreamException
-
writeEndSegment
EDIStreamWriter writeEndSegment() throws EDIStreamException
- Throws:
EDIStreamException
-
writeStartElement
EDIStreamWriter writeStartElement() throws EDIStreamException
- Throws:
EDIStreamException
-
writeStartElementBinary
EDIStreamWriter writeStartElementBinary() throws EDIStreamException
- Throws:
EDIStreamException
-
endElement
EDIStreamWriter endElement() throws EDIStreamException
- Throws:
EDIStreamException
-
writeRepeatElement
EDIStreamWriter writeRepeatElement() throws EDIStreamException
- Throws:
EDIStreamException
-
startComponent
EDIStreamWriter startComponent() throws EDIStreamException
- Throws:
EDIStreamException
-
endComponent
EDIStreamWriter endComponent() throws EDIStreamException
- Throws:
EDIStreamException
-
writeEmptyElement
EDIStreamWriter writeEmptyElement() throws EDIStreamException
- Throws:
EDIStreamException
-
writeElement
EDIStreamWriter writeElement(CharSequence text) throws EDIStreamException
- Throws:
EDIStreamException
-
writeElement
EDIStreamWriter writeElement(char[] text, int start, int end) throws EDIStreamException
- Throws:
EDIStreamException
-
writeEmptyComponent
EDIStreamWriter writeEmptyComponent() throws EDIStreamException
- Throws:
EDIStreamException
-
writeComponent
EDIStreamWriter writeComponent(CharSequence text) throws EDIStreamException
- Throws:
EDIStreamException
-
writeComponent
EDIStreamWriter writeComponent(char[] text, int start, int end) throws EDIStreamException
- Throws:
EDIStreamException
-
writeElementData
EDIStreamWriter writeElementData(CharSequence text) throws EDIStreamException
- Throws:
EDIStreamException
-
writeElementData
EDIStreamWriter writeElementData(char[] text, int start, int end) throws EDIStreamException
- Throws:
EDIStreamException
-
writeBinaryData
EDIStreamWriter writeBinaryData(InputStream stream) throws EDIStreamException
- Throws:
EDIStreamException
-
writeBinaryData
EDIStreamWriter writeBinaryData(byte[] text, int start, int end) throws EDIStreamException
- Throws:
EDIStreamException
-
writeBinaryData
EDIStreamWriter writeBinaryData(ByteBuffer buffer) throws EDIStreamException
- Throws:
EDIStreamException
-
-