public class MimeEncoder extends MimeEncoderImpl
Implementation of AdaptrisMessageEncoder
that stores AdaptrisMessage
payload and metadata as a
mime-encoded multipart message.
The metadata is treated as a though it were a set of Properties, therefore using = as part of either the metadata key or data makes the behaviour undefined.
By default the data is not encoded, however this behaviour can be overriden through use of the setMetadataEncoding()
and setPayloadEncoding()
methods.
In the adapter configuration file this class is aliased as mime-encoder which is the preferred alternative to the fully qualified classname when building your configuration.
EXCEPTION_CONTENT_ID, METADATA_CONTENT_ID, PAYLOAD_CONTENT_ID
log
Constructor and Description |
---|
MimeEncoder() |
MimeEncoder(java.lang.Boolean retainUniqueId,
java.lang.String metadataEncoding,
java.lang.String payloadEncoding) |
Modifier and Type | Method and Description |
---|---|
AdaptrisMessage |
decode(byte[] bytes)
Convenience method that is available so that existing underlying
implementations are not broken due to the AdaptrisMessageEncoder interface
change.
|
byte[] |
encode(AdaptrisMessage msg)
Convenience method that is available so that existing underlying
implementations are not broken due to the AdaptrisMessageEncoder interface
change.
|
AdaptrisMessage |
readMessage(java.lang.Object source)
Decode the supplied Object into an
AdaptrisMessage object. |
void |
writeMessage(AdaptrisMessage msg,
java.lang.Object target)
Encode the
AdaptrisMessage object and write it to the supplied
target |
addPartsToMessage, asMimePart, getMetadata, getMetadataEncoding, getMetadataSet, getPayloadEncoding, getRetainUniqueId, payloadAsMimePart, retainUniqueId, setMetadataEncoding, setPayloadEncoding, setRetainUniqueId
currentMessageFactory, registerMessageFactory
public MimeEncoder()
public MimeEncoder(java.lang.Boolean retainUniqueId, java.lang.String metadataEncoding, java.lang.String payloadEncoding)
public void writeMessage(AdaptrisMessage msg, java.lang.Object target) throws CoreException
AdaptrisMessageEncoder
AdaptrisMessage
object and write it to the supplied
targetmsg
- the AdaptrisMessage
to be encodedtarget
- the destination to write to.CoreException
- wrapping any underlying Exceptions that may occurpublic AdaptrisMessage readMessage(java.lang.Object source) throws CoreException
AdaptrisMessageEncoder
AdaptrisMessage
object.source
- the object to be decoded.AdaptrisMessage
created from the object.CoreException
- wrapping any underlying Exceptions that may occurpublic byte[] encode(AdaptrisMessage msg) throws CoreException
msg
- the message to encode as a byte array.CoreException
public AdaptrisMessage decode(byte[] bytes) throws CoreException
bytes
- the bytes to decode.CoreException
- wrapping any underyling exception.