-
- All Superinterfaces:
AutoCloseable
public interface EDIStreamWriter extends AutoCloseable
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Close this writer and free any resources associated with the writer.EDIStreamWriterendComponent()EDIStreamWriterendElement()EDIStreamWriterendInterchange()voidflush()Write any cached data to the underlying output mechanism.SchemagetControlSchema()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.LocationgetLocation()Return the current location of the writer.ObjectgetProperty(String name)Get the value of a feature/property from the underlying implementationStringgetStandard()Get the EDI standard name.voidsetControlSchema(Schema controlSchema)Sets the schema to be used for validation of the control structure for this stream writer.voidsetTransactionSchema(Schema transactionSchema)Sets the schema to be used for validation of the business transaction for this stream writer.EDIStreamWriterstartComponent()EDIStreamWriterstartInterchange()EDIStreamWriterwriteBinaryData(byte[] text, int start, int end)EDIStreamWriterwriteBinaryData(InputStream stream)EDIStreamWriterwriteBinaryData(ByteBuffer buffer)EDIStreamWriterwriteComponent(char[] text, int start, int end)EDIStreamWriterwriteComponent(CharSequence text)EDIStreamWriterwriteElement(char[] text, int start, int end)EDIStreamWriterwriteElement(CharSequence text)EDIStreamWriterwriteElementData(char[] text, int start, int end)EDIStreamWriterwriteElementData(CharSequence text)EDIStreamWriterwriteEmptyComponent()EDIStreamWriterwriteEmptyElement()EDIStreamWriterwriteEndSegment()EDIStreamWriterwriteRepeatElement()EDIStreamWriterwriteStartElement()EDIStreamWriterwriteStartElementBinary()EDIStreamWriterwriteStartSegment(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 EDIStreamExceptionClose this writer and free any resources associated with the writer. This must not close the underlying output stream.- Specified by:
closein interfaceAutoCloseable- Throws:
EDIStreamException- if there are errors freeing associated resources
-
flush
void flush() throws EDIStreamExceptionWrite 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.
- 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
-
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
-
-