public class JCSMPGenericXMLMessage extends JCSMPXMLMessage implements JCSMPBytesXMLMessage, JCSMPStreamXMLMessage, JCSMPTextXMLMessage
FLAG_COMPAT_PERSISTENT_UNSET, FLAG_COMPAT_SETPERSISTENT, NULL_FLOWID, NULL_MSGID, PRORITY_DEFAULT, PRORITY_MAX, PRORITY_UNDEFINEDMSGDUMP_BRIEF, MSGDUMP_FULL, SDK_BINARY_METADATA_PORTION, STRUCTURED_MAP_MESSAGE, STRUCTURED_STREAM_MESSAGE, STRUCTURED_TEXT_MESSAGE, UNSTRUCTURED_JMS_BYTES_MESSAGE, UNSTRUCTURED_JMS_OBJECT_MESSAGE, UNSTRUCTURED_JMS_PROPERTIES_MESSAGE, UNSTRUCTURED_MESSAGE, UNSTRUCTURED_XML_MESSAGE| Modifier and Type | Method and Description |
|---|---|
String |
dump()
Produces a human-readable dump of the message properties and its contents
(can be quite large).
|
String |
dump(int flags)
Produces a human-readable dump of the message properties and its
contents.
|
byte[] |
getBytes()
Gets a byte array with the message content of the XML part.
|
InputStream |
getStream()
Get the
InputStream from which the message content can be read. |
String |
getText()
Get the message content as text.
|
int |
readBytes(byte[] value)
Reads a byte array from the message content and copies the data read to
the supplied byte array.
|
int |
readBytes(byte[] value,
int length)
Reads
length bytes from the message content, and copies the
data read to the supplied byte array. |
int |
readContentBytes(byte[] byteOutputBuffer)
Reads from the message content, copying the data to the supplied byte
array.
|
int |
readContentBytes(byte[] byteOutputBuffer,
int length)
Reads
length bytes from the message content, copying the
data to the supplied byte array. |
int |
readContentBytes(int srcPos,
byte[] destination,
int destPos,
int length)
Reads
length bytes from the message content, copying the
data to the supplied byte array. |
void |
reset()
Resets the message, clearing all fields, preparing it for publishing
again.
|
void |
reset(boolean resetMsgType) |
void |
rewindContent()
Resets the read mark for the message content to 0.
|
void |
setMessageIdForResend(String messageId) |
void |
setStream(InputStream stream)
Set the
InputStream from which the message content can be read. |
void |
setText(String text)
Set the message content as text.
|
void |
setText(String text,
String charsetName)
Set the message content as text.
|
void |
writeBytes(byte[] value)
Writes a byte array to the message content of the XML part, appending to existing content
if present.
|
void |
writeBytes(byte[] value,
int offset,
int length)
Writes a partial byte array to the message content of the XML part, appending to existing
content if present.
|
ackMessage, callout_ad_release_opportunity, checkHdrStoreInBinMeta, clearAttachment, clearBinaryMetadataBytes, clearContent, clearMetadata, clearQueueNameLocation, clearReadOnly, clearTopicNameLocation, equals, getAckMessageId, getAdSessionUid, getApplicationMessageId, getApplicationMessageType, getAppMessageID, getAppMessageType, getAttachmentByteBuffer, getAttachmentContent, getAttachmentContentBuffer, getAttachmentContentLength, getBinaryMetadataCB, getBinaryMetadataContentLength, getBinaryMetadataType, getBinaryMetadataTypes, getCacheRequestId, getChannel, getCompatFlags, getConsumerIdList, getContent, getContentBuffer, getContentLength, getCorrelationId, getCorrelationKey, getCos, getDeliverToOne, getDeliveryMode, getDestination, getDestinationReceivedBytes, getDestinationSent, getDestinationTopicSuffix, getDiscardIndication, getEncPubMsgHeader, getExpiration, getExpirationBinaryMeta, getFlowId, getHTTPContentEncoding, getHTTPContentType, getInternalProducerId, getLargeMsgInfo, getMessageConsumer, getMessageId, getMessageIdLong, getMessageType, getMetadataContent, getMetadataContentBuffer, getMetadataContentLength, getMsgPool, getPrevMessageId, getPriority, getProperties, getQueueNameLength, getQueueNameOffset, getReceiveTimestamp, getRedelivered, getReplyTo, getReplyToSuffix, getSafeToRetransmitTstamp, getSendCount, getSenderId, getSenderID, getSenderTimestamp, getSendTimestamp, getSeqNum, getSequenceNumber, getSession, getStructuredMsgType, getTimeToLive, getTopicNameLength, getTopicNameOffset, getTopicSequenceNumber, getTQDiscardIndication, getUserData, hasAttachment, hasBinaryMetadata, hasBinaryMetadataAny, hasContent, hashCode, hasMetadata, hasUserData, incrementSendCount, isAckImmediately, isCacheMessage, isDMQEligible, isElidingEligible, isFlagReturnedToPool, isForceRedeliveredFlag, isNewMsgIdRequired, isReadOnly, isReplyMessage, isRetransmitting, isSafeToRelease, isSafeToRetransmit, isSendAttemptedOnce, isSenderIDSetByUser, isSendTimestampSetByUser, isSequenceNumberSetByUser, isStructuredMsg, isSuspect, readAttachmentBytes, readAttachmentBytes, readAttachmentBytes, readBinaryMetadataBytes, readMetadataBytes, readMetadataBytes, readMetadataBytes, rejectMessage, releaseContentBuffer, resetExpirationBinaryMeta, resetSendCount, returnMessageToPool, rewindAttachment, rewindMetadata, set_ad_release_expect, setAckImmediately, setAckMessageId, setAdSessionUid, setApplicationMessageId, setApplicationMessageType, setAppMessageID, setAppMessageType, setAsReplyMessage, setBinaryMetadataCB, setCacheMessage, setCacheRequestId, setChannel, setCorrelationId, setCorrelationKey, setCos, setDeliverToOne, setDeliveryMode, setDestinationReceived, setDestinationReceivedBytes, setDestinationSent, setDiscardIndication, setDMQEligible, setElidingEligible, setExpiration, setExpirationBinaryMeta, setFlagReturnedToPool, setFlowId, setForceRedeliveredFlag, setHTTPContentEncoding, setHTTPContentType, setInternalP2pTopicDescriptionBase, setInternalProducerId, setLargeMsgInfo, setMessageConsumer, setMessageIdLong, setMessageType, setMsgPool, setNewMsgIdRequired, setPrevMessageId, setPriority, setProperties, setQueueNameLocation, setReadOnly, setReceiveTimestamp, setRedelivered, setReplyTo, setReplyToSuffix, setRetransmitting, setSafeToRelease, setSafeToRetransmit, setSafeToRetransmitTstamp, setSendAttemptedOnce, setSenderId_internal, setSenderId, setSenderID, setSenderTimestamp, setSendTimestamp_internal, setSendTimestamp, setSeqNum, setSequenceNumber_internal, setSequenceNumber, setSession, setStructuredMsg, setStructuredMsgType, setSuspect, setTimeToLive, setTopicNameLocation, setTopicSequenceNumber, setTQDiscardIndication, setUserData, toString, writeAttachment, writeAttachment, writeAttachment, writeBinaryMetadataBytes, writeBinaryMetadataBytes, writeCidListData, writeMetadata, writeMetadata, writeMetadata, writeNewAttachment, writeNewAttachment, writeNewAttachment, writeNewAttachmentackMessage, clearAttachment, clearBinaryMetadataBytes, clearContent, clearQueueNameLocation, clearTopicNameLocation, getAckMessageId, getApplicationMessageId, getApplicationMessageType, getAppMessageID, getAppMessageType, getAttachmentByteBuffer, getAttachmentContentLength, getBinaryMetadataContentLength, getBinaryMetadataTypes, getCacheRequestId, getConsumerIdList, getContentLength, getCorrelationId, getCorrelationKey, getCos, getDeliverToOne, getDeliveryMode, getDestination, getDestinationTopicSuffix, getDiscardIndication, getExpiration, getHTTPContentEncoding, getHTTPContentType, getMessageId, getMessageIdLong, getMessageType, getPriority, getProperties, getQueueNameLength, getQueueNameOffset, getReceiveTimestamp, getRedelivered, getReplyTo, getReplyToSuffix, getSenderId, getSenderID, getSenderTimestamp, getSendTimestamp, getSequenceNumber, getStructuredMsgType, getTimeToLive, getTopicNameLength, getTopicNameOffset, getTopicSequenceNumber, getTQDiscardIndication, getUserData, hasAttachment, hasBinaryMetadata, hasContent, hasUserData, isAckImmediately, isCacheMessage, isDMQEligible, isElidingEligible, isReadOnly, isReplyMessage, isStructuredMsg, isSuspect, readAttachmentBytes, readAttachmentBytes, readAttachmentBytes, readBinaryMetadataBytes, rejectMessage, rewindAttachment, setAckImmediately, setApplicationMessageId, setApplicationMessageType, setAppMessageID, setAppMessageType, setAsReplyMessage, setCorrelationId, setCorrelationKey, setCos, setDeliverToOne, setDeliveryMode, setDMQEligible, setElidingEligible, setExpiration, setHTTPContentEncoding, setHTTPContentType, setMessageType, setPriority, setProperties, setQueueNameLocation, setReadOnly, setReplyTo, setReplyToSuffix, setSenderId, setSenderID, setSenderTimestamp, setSendTimestamp, setSequenceNumber, setStructuredMsg, setStructuredMsgType, setTimeToLive, setTopicNameLocation, setUserData, writeAttachment, writeAttachment, writeAttachment, writeBinaryMetadataBytes, writeBinaryMetadataBytes, writeNewAttachment, writeNewAttachment, writeNewAttachment, writeNewAttachmentpublic void reset()
XMLMessageJCSMPFactory.reset in interface XMLMessagereset in class JCSMPXMLMessagepublic void reset(boolean resetMsgType)
reset in class JCSMPXMLMessagepublic void setMessageIdForResend(String messageId)
setMessageIdForResend in interface JCSMPBytesXMLMessagepublic int readContentBytes(int srcPos,
byte[] destination,
int destPos,
int length)
XMLMessagelength bytes from the message content, copying the
data to the supplied byte array.
If the number of bytes to be read in the content is less than
length, all content bytes are read into the array.
readContentBytes in interface XMLMessagesrcPos - The starting position in the source array.destination - A destination byte array to fill.destPos - The starting position in the destination array.length - The number of bytes to read.public int readContentBytes(byte[] byteOutputBuffer,
int length)
XMLMessagelength bytes from the message content, copying the
data to the supplied byte array.
If the number of bytes to be read in the content is less than
length, all content bytes are read into the array.
readContentBytes in interface XMLMessagebyteOutputBuffer - A destination byte array to fill.length - The number of bytes to read.public int readContentBytes(byte[] byteOutputBuffer)
XMLMessagereadContentBytes in interface XMLMessagebyteOutputBuffer - A destination byte array to fill.public int readBytes(byte[] value)
BytesXMLMessage
If the length of array value is less than the number of
bytes remaining to be read from the message content, the array is filled.
The read mark for the message content is incremented by the number of
bytes read. A subsequent call reads from the read mark, and so on.
If the number of bytes remaining in the message content is less than the
length of array value, the bytes are read into the array.
The read mark for the message content is incremented by the number of
bytes read. The return value of the total number of bytes read is less
than the length of the array, which indicates that there are no more
bytes left to be read from the message content. The next read would then
return -1.
readBytes in interface BytesXMLMessagevalue - The buffer into which the data is read.BytesXMLMessage.readBytes(byte[])public int readBytes(byte[] value,
int length)
BytesXMLMessagelength bytes from the message content, and copies the
data read to the supplied byte array.
If length is less than the number of bytes remaining to be
read from the message content, length bytes are read. The
read mark for the message content is incremented by the number of bytes
read. A subsequent call reads from the read mark, and so on.
If the number of bytes remaining to be read in the message content is
less than length, the remaining bytes are read into the
array. The read mark for the message content is incremented by the number
of bytes read. The return value of the total number of bytes read is less
than length, which indicates that there are no more bytes
left to be read from the message content. The next read of the message
returns -1.
If length is greater than the length of the array
value, an IndexOutOfBoundsException is thrown.
No bytes are read from the message content for this exception case.
readBytes in interface BytesXMLMessagevalue - The buffer into which the data is read.length - The number of bytes to read; this must be less than or equal to
value.length.BytesXMLMessage.readBytes(byte[], int)public void rewindContent()
BytesXMLMessageBytesXMLMessage.readBytes(byte[]) or BytesXMLMessage.readBytes(byte[], int) reads from
the beginning of the message content.rewindContent in interface BytesXMLMessageBytesXMLMessage.rewindContent()public void writeBytes(byte[] value)
BytesXMLMessage
An application that wants to replace content, for example when publishing
the same message again with different content, can call
XMLMessage.clearContent(), then write the new data.
This method copies the input bytes into the message.
writeBytes in interface BytesXMLMessagevalue - The byte array to be written (by appending to existing data).BytesXMLMessage.writeBytes(byte[])public void writeBytes(byte[] value,
int offset,
int length)
BytesXMLMessage
An application that wants to replace content, for example when publishing
the same message again with different content, can call
XMLMessage.clearContent(), then write the new data.
This method copies the input bytes into the message.
writeBytes in interface BytesXMLMessagevalue - The byte array to be written.offset - The initial offset within the byte array.length - The number of bytes to use.BytesXMLMessage.writeBytes(byte[], int, int)public byte[] getBytes()
BytesXMLMessageThe message content is returned when the message is read-only. Otherwise, the method returns an empty byte array.
Note that there is no guarantee that the array will have the same length
as the content; it may in fact be larger. Applications should only read
the number of bytes returned by XMLMessage.getContentLength().
getBytes in interface BytesXMLMessagepublic InputStream getStream()
StreamXMLMessageInputStream from which the message content can be read.
On the publisher side, if the application attempts to acquire the InputStream and
read from it, the behavior is undefined.
getStream in interface StreamXMLMessageStreamXMLMessage.getStream()public void setStream(InputStream stream) throws IOException
StreamXMLMessageInputStream from which the message content can be read.setStream in interface StreamXMLMessagestream - A stream from which to read message content.IOException - If an error occurs reading from input stream.StreamXMLMessage.setStream(java.io.InputStream)public String getText()
TextXMLMessagegetText in interface TextXMLMessageTextXMLMessage.getText()public void setText(String text)
TextXMLMessagesetText in interface TextXMLMessagetext - The message text.TextXMLMessage.setText(java.lang.String)public void setText(String text, String charsetName) throws UnsupportedEncodingException
TextXMLMessagesetText in interface TextXMLMessagetext - The message text.charsetName - The name of a supported java.nio.charset.Charset.UnsupportedEncodingException - If the named charset is not supported.TextXMLMessage.setText(java.lang.String, java.lang.String)public String dump()
XMLMessagedump(MSGDUMP_FULL).dump in interface XMLMessageString representation of the message, to be used
for debugging.public String dump(int flags)
XMLMessage
dump in interface XMLMessageflags - Flags controlling the output, such as whether to include
verbose (binary dump) informationString representation of the message, to be used
for debugging.Copyright 2004-2020 Solace Corporation. All rights reserved.