- java.lang.Object
-
- io.xlate.edi.internal.stream.StaEDIStreamWriter
-
- All Implemented Interfaces:
ElementDataHandler,ValidationEventHandler,EDIStreamWriter
public class StaEDIStreamWriter extends Object implements EDIStreamWriter, ElementDataHandler, ValidationEventHandler
-
-
Constructor Summary
Constructors Constructor Description StaEDIStreamWriter(OutputStream stream, String encoding, Map<String,Object> properties)
-
Method Summary
-
-
-
Constructor Detail
-
StaEDIStreamWriter
public StaEDIStreamWriter(OutputStream stream, String encoding, Map<String,Object> properties)
-
-
Method Detail
-
getProperty
public Object getProperty(String name)
Description copied from interface:EDIStreamWriterGet the value of a feature/property from the underlying implementation- Specified by:
getPropertyin interfaceEDIStreamWriter- Parameters:
name- - The name of the property, may not be null- Returns:
- The value of the property
-
close
public void close() throws EDIStreamExceptionDescription copied from interface:EDIStreamWriterClose this writer and free any resources associated with the writer. This must not close the underlying output stream.- Specified by:
closein interfaceEDIStreamWriter- Throws:
EDIStreamException- if there are errors freeing associated resources
-
flush
public void flush() throws EDIStreamExceptionDescription copied from interface:EDIStreamWriterWrite any cached data to the underlying output mechanism.- Specified by:
flushin interfaceEDIStreamWriter- Throws:
EDIStreamException- if there are errors flushing the cache
-
setControlSchema
public void setControlSchema(Schema controlSchema)
Description copied from interface:EDIStreamWriterSets 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.
- Specified by:
setControlSchemain interfaceEDIStreamWriter- Parameters:
controlSchema- the schema instance to use for validation of control structures
-
setTransactionSchema
public void setTransactionSchema(Schema transactionSchema)
Description copied from interface:EDIStreamWriterSets 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.
- Specified by:
setTransactionSchemain interfaceEDIStreamWriter- Parameters:
transactionSchema- the schema instance to use for validation of business transaction structures
-
getLocation
public Location getLocation()
Description copied from interface:EDIStreamWriterReturn 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.- Specified by:
getLocationin interfaceEDIStreamWriter- Returns:
- current location of the writer
-
startInterchange
public EDIStreamWriter startInterchange() throws EDIStreamException
- Specified by:
startInterchangein interfaceEDIStreamWriter- Throws:
EDIStreamException
-
endInterchange
public EDIStreamWriter endInterchange() throws EDIStreamException
- Specified by:
endInterchangein interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeStartSegment
public EDIStreamWriter writeStartSegment(String name) throws EDIStreamException
- Specified by:
writeStartSegmentin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeEndSegment
public EDIStreamWriter writeEndSegment() throws EDIStreamException
- Specified by:
writeEndSegmentin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeStartElement
public EDIStreamWriter writeStartElement() throws EDIStreamException
- Specified by:
writeStartElementin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeStartElementBinary
public EDIStreamWriter writeStartElementBinary() throws EDIStreamException
- Specified by:
writeStartElementBinaryin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeRepeatElement
public EDIStreamWriter writeRepeatElement() throws EDIStreamException
- Specified by:
writeRepeatElementin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
endElement
public EDIStreamWriter endElement() throws EDIStreamException
- Specified by:
endElementin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
startComponent
public EDIStreamWriter startComponent() throws EDIStreamException
- Specified by:
startComponentin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
endComponent
public EDIStreamWriter endComponent() throws EDIStreamException
- Specified by:
endComponentin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeElement
public EDIStreamWriter writeElement(CharSequence text) throws EDIStreamException
- Specified by:
writeElementin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeElement
public EDIStreamWriter writeElement(char[] text, int start, int end) throws EDIStreamException
- Specified by:
writeElementin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeEmptyElement
public EDIStreamWriter writeEmptyElement() throws EDIStreamException
- Specified by:
writeEmptyElementin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeComponent
public EDIStreamWriter writeComponent(CharSequence text) throws EDIStreamException
- Specified by:
writeComponentin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeComponent
public EDIStreamWriter writeComponent(char[] text, int start, int end) throws EDIStreamException
- Specified by:
writeComponentin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeEmptyComponent
public EDIStreamWriter writeEmptyComponent() throws EDIStreamException
- Specified by:
writeEmptyComponentin interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeElementData
public EDIStreamWriter writeElementData(CharSequence text) throws EDIStreamException
- Specified by:
writeElementDatain interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeElementData
public EDIStreamWriter writeElementData(char[] text, int start, int end) throws EDIStreamException
- Specified by:
writeElementDatain interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeBinaryData
public EDIStreamWriter writeBinaryData(InputStream binaryStream) throws EDIStreamException
- Specified by:
writeBinaryDatain interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeBinaryData
public EDIStreamWriter writeBinaryData(byte[] binary, int start, int end) throws EDIStreamException
- Specified by:
writeBinaryDatain interfaceEDIStreamWriter- Throws:
EDIStreamException
-
writeBinaryData
public EDIStreamWriter writeBinaryData(ByteBuffer binary) throws EDIStreamException
- Specified by:
writeBinaryDatain interfaceEDIStreamWriter- Throws:
EDIStreamException
-
binaryData
public boolean binaryData(InputStream binary)
- Specified by:
binaryDatain interfaceElementDataHandler
-
elementData
public boolean elementData(char[] text, int start, int length)- Specified by:
elementDatain interfaceElementDataHandler
-
loopBegin
public void loopBegin(CharSequence id)
- Specified by:
loopBeginin interfaceValidationEventHandler
-
loopEnd
public void loopEnd(CharSequence id)
- Specified by:
loopEndin interfaceValidationEventHandler
-
elementError
public void elementError(EDIStreamEvent event, EDIStreamValidationError error, CharSequence referenceCode, int element, int component, int repetition)
- Specified by:
elementErrorin interfaceValidationEventHandler
-
segmentError
public void segmentError(CharSequence token, EDIStreamValidationError error)
- Specified by:
segmentErrorin interfaceValidationEventHandler
-
-