Package com.adaptris.core
Interface MultiPayloadAdaptrisMessage
-
- All Superinterfaces:
AdaptrisMessage
,InterlokMessage
- All Known Implementing Classes:
MultiPayloadAdaptrisMessageImp
public interface MultiPayloadAdaptrisMessage extends AdaptrisMessage
Interface for Adaptris messages that support multiple payloads, referenced by an ID/key.- Since:
- 3.9.x
- See Also:
AdaptrisMessage
-
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
DEFAULT_PAYLOAD_ID
The ID to use for the default payload.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addContent(@NotNull java.lang.String id, java.lang.String content)
Add a new payload to the message, with the given ID and content.void
addContent(@NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.void
addPayload(@NotNull java.lang.String id, byte[] payload)
Add a new payload to the message, with the given ID and data.void
deletePayload(@NotNull java.lang.String id)
Delete an existing payload, with the given payload ID.java.lang.String
getContent(@NotNull java.lang.String id)
Get the payload content for the given ID.java.lang.String
getContentEncoding(@NotNull java.lang.String id)
Get the content encoding for the given payload ID.java.lang.String
getCurrentPayloadId()
Get the ID of the current payload.java.io.InputStream
getInputStream(@NotNull java.lang.String id)
Get the input stream for the given payload ID.java.io.OutputStream
getOutputStream(@NotNull java.lang.String id)
Get the output stream for the given payload ID.byte[]
getPayload(@NotNull java.lang.String id)
Get the payload data for the given ID.int
getPayloadCount()
Return the number of payloads contained within the message.java.util.Set<java.lang.String>
getPayloadIDs()
Get the payload IDs used within this message.long
getSize(@NotNull java.lang.String id)
Get the size of the payload for the given ID.java.io.Writer
getWriter(@NotNull java.lang.String id)
Return a writer ready for writing the payload for the given payload ID.java.io.Writer
getWriter(@NotNull java.lang.String id, java.lang.String encoding)
Return a writer ready for writing the payload for the given payload ID.boolean
hasPayloadId(@NotNull java.lang.String id)
Indicates whether the given payload ID exists in the message.void
setContent(@NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.void
setContentEncoding(@NotNull java.lang.String id, java.lang.String encoding)
Set the payload content encoding for the given payload ID.void
setCurrentPayloadId(@NotNull java.lang.String id)
Update the ID of the current payload.void
switchPayload(@NotNull java.lang.String id)
Switch from one payload to another, given by the ID.-
Methods inherited from interface com.adaptris.core.AdaptrisMessage
addEvent, addMetadata, addMetadata, addObjectMetadata, clearMetadata, clone, containsKey, encode, equivalentForTracking, getCharEncoding, getFactory, getMessageLifecycleEvent, getMetadata, getMetadata, getMetadataValue, getMetadataValueIgnoreKeyCase, getNextServiceId, getObjectMetadata, getPayload, getPayloadForLogging, getSize, getStringPayload, removeMetadata, setCharEncoding, setMetadata, setNextServiceId, setPayload, setStringPayload, setStringPayload
-
Methods inherited from interface com.adaptris.interlok.types.InterlokMessage
addMessageHeader, addObjectHeader, getContent, getContentEncoding, getInputStream, getMessageHeaders, getObjectHeaders, getOutputStream, getReader, getUniqueId, getWriter, headersContainsKey, removeMessageHeader, resolve, resolve, resolveObject, setContent, setContentEncoding, setMessageHeaders, setUniqueId, wrap
-
-
-
-
Field Detail
-
DEFAULT_PAYLOAD_ID
static final java.lang.String DEFAULT_PAYLOAD_ID
The ID to use for the default payload.- See Also:
- Constant Field Values
-
-
Method Detail
-
switchPayload
void switchPayload(@NotNull @NotNull java.lang.String id)
Switch from one payload to another, given by the ID.- Parameters:
id
- The ID of the payload to switch to.
-
hasPayloadId
boolean hasPayloadId(@NotNull @NotNull java.lang.String id)
Indicates whether the given payload ID exists in the message.- Parameters:
id
- The payload ID to check.- Returns:
- True if there's a payload with the given ID, false otherwise.
-
getCurrentPayloadId
java.lang.String getCurrentPayloadId()
Get the ID of the current payload.- Returns:
- The payload ID.
-
getPayloadIDs
java.util.Set<java.lang.String> getPayloadIDs()
Get the payload IDs used within this message.- Returns:
- The payload IDs.
-
setCurrentPayloadId
void setCurrentPayloadId(@NotNull @NotNull java.lang.String id)
Update the ID of the current payload. This does not change the current working payload, rather updates the ID of the current working payload.- Parameters:
id
- The new payload ID.
-
addPayload
void addPayload(@NotNull @NotNull java.lang.String id, byte[] payload)
Add a new payload to the message, with the given ID and data.- Parameters:
id
- The new payload ID.payload
- The payload data.
-
deletePayload
void deletePayload(@NotNull @NotNull java.lang.String id)
Delete an existing payload, with the given payload ID.- Parameters:
id
- The payload ID.
-
getPayload
byte[] getPayload(@NotNull @NotNull java.lang.String id)
Get the payload data for the given ID.- Parameters:
id
- The payload ID.- Returns:
- The payload data.
-
getSize
long getSize(@NotNull @NotNull java.lang.String id)
Get the size of the payload for the given ID.- Parameters:
id
- The payload ID.- Returns:
- The payload size.
-
getPayloadCount
int getPayloadCount()
Return the number of payloads contained within the message.- Returns:
- The number of payloads.
-
addContent
void addContent(@NotNull @NotNull java.lang.String id, java.lang.String content)
Add a new payload to the message, with the given ID and content.- Parameters:
id
- The new payload ID.content
- The payload content.
-
addContent
void addContent(@NotNull @NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.- Parameters:
id
- The new payload ID.content
- The payload content.encoding
- The content encoding.
-
setContent
void setContent(@NotNull @NotNull java.lang.String id, java.lang.String content, java.lang.String encoding)
Add a new payload to the message, with the given ID and content and encoding.- Parameters:
id
- The new payload ID.content
- The payload content.encoding
- The content encoding.
-
getContent
java.lang.String getContent(@NotNull @NotNull java.lang.String id)
Get the payload content for the given ID.- Parameters:
id
- The payload ID.- Returns:
- The payload content.
-
setContentEncoding
void setContentEncoding(@NotNull @NotNull java.lang.String id, java.lang.String encoding)
Set the payload content encoding for the given payload ID.- Parameters:
id
- The payload ID.encoding
- The content encoding.
-
getContentEncoding
java.lang.String getContentEncoding(@NotNull @NotNull java.lang.String id)
Get the content encoding for the given payload ID.- Parameters:
id
- The payload ID.- Returns:
- The content encoding.
-
getInputStream
java.io.InputStream getInputStream(@NotNull @NotNull java.lang.String id)
Get the input stream for the given payload ID.- Parameters:
id
- The payload ID.- Returns:
- The payload input stream.
-
getOutputStream
java.io.OutputStream getOutputStream(@NotNull @NotNull java.lang.String id)
Get the output stream for the given payload ID.- Parameters:
id
- The payload ID.- Returns:
- The payload output stream.
-
getWriter
java.io.Writer getWriter(@NotNull @NotNull java.lang.String id) throws java.io.IOException
Return a writer ready for writing the payload for the given payload ID.- Specified by:
getWriter
in interfaceInterlokMessage
- Parameters:
id
- The payload ID.- Returns:
- an Writer that can be used to write the payload using the existing encoding.
- Throws:
java.io.IOException
- if the Writer could not be created.
-
getWriter
java.io.Writer getWriter(@NotNull @NotNull java.lang.String id, java.lang.String encoding) throws java.io.IOException
Return a writer ready for writing the payload for the given payload ID.- Parameters:
id
- The payload ID.encoding
- The payload encoding.- Returns:
- an Writer that can be used to write the payload using the existing encoding.
- Throws:
java.io.IOException
- if the Writer could not be created.
-
-