Package org.apache.qpid.proton.message.impl

# Class MessageImpl

java.lang.Object
org.apache.qpid.proton.message.impl.MessageImpl

All Implemented Interfaces:
  `Message`, `ProtonJMessage`

public class MessageImpl extends Object implements ProtonJMessage

## Nested Class Summary

## Nested classes/interfaces inherited from interface org.apache.qpid.proton.message.Message

`Message.Factory`

## Field Summary

### Fields inherited from interface org.apache.qpid.proton.message.Message

`DEFAULT_PRIORITY`

## Constructor Summary

Constructors
Constructor
Description
`MessageImpl()`
Application code should use `Message.Factory.create()` instead.
`MessageImpl(Header header, DeliveryAnnotations deliveryAnnotations, MessageAnnotations messageAnnotations, Properties properties, ApplicationProperties applicationProperties, Section body, Footer footer)`
Application code should instead use `Message.Factory.create(Header, DeliveryAnnotations, MessageAnnotations, Properties, ApplicationProperties, Section, Footer)`

## Method Summary

Modifier and Type
Method
Description
`void`
`clear()`
`int`
`decode(byte[] data, int offset, int length)`
TODO describe what happens if the data does not represent a complete message.
`void`
`decode(ByteBuffer buffer)`
`void`
`decode(ReadableBuffer buffer)`
Decodes the Message from the given `ReadableBuffer`.
`int`
`encode(byte[] data, int offset, int length)`
Encodes up to `length` bytes of the message into the provided byte array, starting at position `offset`.
`int`
`encode(WritableBuffer buffer)`
Encodes the current Message contents into the given `WritableBuffer` instance.
`int`
`encode2(byte[] data, int offset, int length)`
`String`
`getAddress()`
`ApplicationProperties`
`getApplicationProperties()`
`Section`
`getBody()`
`String`
`getContentEncoding()`
`String`
`getContentType()`
`Object`
`getCorrelationId()`
`long`
`getCreationTime()`
`DeliveryAnnotations`
`getDeliveryAnnotations()`
`long`
`getDeliveryCount()`
`MessageError`
`getError()`
`long`
`getExpiryTime()`
`Footer`
`getFooter()`
`String`
`getGroupId()`
`long`
`getGroupSequence()`
`Header`
`getHeader()`
`MessageAnnotations`
`getMessageAnnotations()`
`Object`
`getMessageId()`
`short`
`getPriority()`
`Properties`
`getProperties()`
`String`
`getReplyTo()`
`String`
`getReplyToGroupId()`
`String`
`getSubject()`
`long`
`getTtl()`
`byte[]`
`getUserId()`
`boolean`
`isDurable()`
`boolean`
`isFirstAcquirer()`
`void`
`setAddress(String to)`
`void`
`setApplicationProperties(ApplicationProperties applicationProperties)`
`void`
`setBody(Section body)`
`void`
`setContentEncoding(String contentEncoding)`
`void`
`setContentType(String contentType)`
`void`
`setCorrelationId(Object correlationId)`
`void`
`setCreationTime(long creationTime)`
`void`
`setDeliveryAnnotations(DeliveryAnnotations deliveryAnnotations)`
`void`
`setDeliveryCount(long deliveryCount)`
`void`
`setDurable(boolean durable)`
`void`
`setExpiryTime(long absoluteExpiryTime)`
`void`
`setFirstAcquirer(boolean firstAcquirer)`
`void`
`setFooter(Footer footer)`
`void`
`setGroupId(String groupId)`
`void`
`setGroupSequence(long groupSequence)`
`void`
`setHeader(Header header)`
`void`
`setMessageAnnotations(MessageAnnotations messageAnnotations)`
`void`
`setMessageId(Object messageId)`
`void`
`setPriority(short priority)`
`void`
`setProperties(Properties properties)`
`void`
`setReplyTo(String replyTo)`
`void`
`setReplyToGroupId(String replyToGroupId)`
`void`
`setSubject(String subject)`
`void`
`setTtl(long ttl)`
`void`
`setUserId(byte[] userId)`
`String`
`toString()`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Constructor Details

### MessageImpl

public MessageImpl()
Application code should use `Message.Factory.create()` instead.

### MessageImpl

public MessageImpl(Header header, DeliveryAnnotations deliveryAnnotations, MessageAnnotations messageAnnotations, Properties properties, ApplicationProperties applicationProperties, Section body, Footer footer)
Application code should instead use `Message.Factory.create(Header, DeliveryAnnotations, MessageAnnotations, Properties, ApplicationProperties, Section, Footer)`

## Method Details

### isDurable

public boolean isDurable()

Specified by:
  `isDurable` in interface `Message`

### getDeliveryCount

public long getDeliveryCount()

Specified by:
  `getDeliveryCount` in interface `Message`

### getPriority

public short getPriority()

Specified by:
  `getPriority` in interface `Message`

### isFirstAcquirer

public boolean isFirstAcquirer()

Specified by:
  `isFirstAcquirer` in interface `Message`

### getTtl

public long getTtl()

Specified by:
  `getTtl` in interface `Message`

### setDurable

public void setDurable(boolean durable)

Specified by:
  `setDurable` in interface `Message`

### setTtl

public void setTtl(long ttl)

Specified by:
  `setTtl` in interface `Message`

### setDeliveryCount

public void setDeliveryCount(long deliveryCount)

Specified by:
  `setDeliveryCount` in interface `Message`

### setFirstAcquirer

public void setFirstAcquirer(boolean firstAcquirer)

Specified by:
  `setFirstAcquirer` in interface `Message`

### setPriority

public void setPriority(short priority)

Specified by:
  `setPriority` in interface `Message`

### getMessageId

public Object getMessageId()

Specified by:
  `getMessageId` in interface `Message`

### getGroupSequence

public long getGroupSequence()

Specified by:
  `getGroupSequence` in interface `Message`

### getReplyToGroupId

public String getReplyToGroupId()

Specified by:
  `getReplyToGroupId` in interface `Message`

### getCreationTime

public long getCreationTime()

Specified by:
  `getCreationTime` in interface `Message`

### getAddress

public String getAddress()

Specified by:
  `getAddress` in interface `Message`

### getUserId

public byte[] getUserId()

Specified by:
  `getUserId` in interface `Message`

### getReplyTo

public String getReplyTo()

Specified by:
  `getReplyTo` in interface `Message`

### getGroupId

public String getGroupId()

Specified by:
  `getGroupId` in interface `Message`

### getContentType

public String getContentType()

Specified by:
  `getContentType` in interface `Message`

### getExpiryTime

public long getExpiryTime()

Specified by:
  `getExpiryTime` in interface `Message`

### getCorrelationId

public Object getCorrelationId()

Specified by:
  `getCorrelationId` in interface `Message`

### getContentEncoding

public String getContentEncoding()

Specified by:
  `getContentEncoding` in interface `Message`

### getSubject

public String getSubject()

Specified by:
  `getSubject` in interface `Message`

### setGroupSequence

public void setGroupSequence(long groupSequence)

Specified by:
  `setGroupSequence` in interface `Message`

### setUserId

public void setUserId(byte[] userId)

Specified by:
  `setUserId` in interface `Message`

### setCreationTime

public void setCreationTime(long creationTime)

Specified by:
  `setCreationTime` in interface `Message`

### setSubject

public void setSubject(String subject)

Specified by:
  `setSubject` in interface `Message`

### setGroupId

public void setGroupId(String groupId)

Specified by:
  `setGroupId` in interface `Message`

### setAddress

public void setAddress(String to)

Specified by:
  `setAddress` in interface `Message`

### setExpiryTime

public void setExpiryTime(long absoluteExpiryTime)

Specified by:
  `setExpiryTime` in interface `Message`

### setReplyToGroupId

public void setReplyToGroupId(String replyToGroupId)

Specified by:
  `setReplyToGroupId` in interface `Message`

### setContentEncoding

public void setContentEncoding(String contentEncoding)

Specified by:
  `setContentEncoding` in interface `Message`

### setContentType

public void setContentType(String contentType)

Specified by:
  `setContentType` in interface `Message`

### setReplyTo

public void setReplyTo(String replyTo)

Specified by:
  `setReplyTo` in interface `Message`

### setCorrelationId

public void setCorrelationId(Object correlationId)

Specified by:
  `setCorrelationId` in interface `Message`

### setMessageId

public void setMessageId(Object messageId)

Specified by:
  `setMessageId` in interface `Message`

### getHeader

public Header getHeader()

Specified by:
  `getHeader` in interface `Message`

### getDeliveryAnnotations

public DeliveryAnnotations getDeliveryAnnotations()

Specified by:
  `getDeliveryAnnotations` in interface `Message`

### getMessageAnnotations

public MessageAnnotations getMessageAnnotations()

Specified by:
  `getMessageAnnotations` in interface `Message`

### getProperties

public Properties getProperties()

Specified by:
  `getProperties` in interface `Message`

### getApplicationProperties

public ApplicationProperties getApplicationProperties()

Specified by:
  `getApplicationProperties` in interface `Message`

### getBody

public Section getBody()

Specified by:
  `getBody` in interface `Message`

### getFooter

public Footer getFooter()

Specified by:
  `getFooter` in interface `Message`

### setHeader

public void setHeader(Header header)

Specified by:
  `setHeader` in interface `Message`

### setDeliveryAnnotations

public void setDeliveryAnnotations(DeliveryAnnotations deliveryAnnotations)

Specified by:
  `setDeliveryAnnotations` in interface `Message`

### setMessageAnnotations

public void setMessageAnnotations(MessageAnnotations messageAnnotations)

Specified by:
  `setMessageAnnotations` in interface `Message`

### setProperties

public void setProperties(Properties properties)

Specified by:
  `setProperties` in interface `Message`

### setApplicationProperties

public void setApplicationProperties(ApplicationProperties applicationProperties)

Specified by:
  `setApplicationProperties` in interface `Message`

### setBody

public void setBody(Section body)

Specified by:
  `setBody` in interface `Message`

### setFooter

public void setFooter(Footer footer)

Specified by:
  `setFooter` in interface `Message`

### decode

public int decode(byte[] data, int offset, int length)
Description copied from interface: `Message`
TODO describe what happens if the data does not represent a complete message. Currently this appears to leave the message in an unknown state.

Specified by:
  `decode` in interface `Message`

### decode

public void decode(ByteBuffer buffer)

### decode

public void decode(ReadableBuffer buffer)
Description copied from interface: `Message`
Decodes the Message from the given `ReadableBuffer`.

If the buffer given does not contain the fully encoded Message bytes for decode this method will throw an exception to indicate the buffer underflow condition and the message object will be left in an undefined state.

Specified by:
  `decode` in interface `Message`
Parameters:
  `buffer` - A `ReadableBuffer` that contains the complete message bytes.

### encode

public int encode(byte[] data, int offset, int length)
Description copied from interface: `Message`
Encodes up to `length` bytes of the message into the provided byte array, starting at position `offset`. TODO describe what happens if length is smaller than the encoded form, Currently Proton-J throws an exception. What does Proton-C do?

Specified by:
  `encode` in interface `Message`
Returns:
  the number of bytes written to the byte array

### encode2

public int encode2(byte[] data, int offset, int length)

Specified by:
  `encode2` in interface `ProtonJMessage`

### encode

public int encode(WritableBuffer buffer)
Description copied from interface: `Message`
Encodes the current Message contents into the given `WritableBuffer` instance.

This method attempts to encode all message data into the `WritableBuffer` and if the buffer has insufficient space it will throw an exception to indicate the buffer overflow condition. If successful the method returns the number of bytes written to the provided buffer to fully encode the message.

Specified by:
  `encode` in interface `Message`
Specified by:
  `encode` in interface `ProtonJMessage`
Parameters:
  `buffer` - The `WritableBuffer` instance to encode the message contents into.
Returns:
  the number of bytes written to fully encode the message.

### clear

public void clear()

Specified by:
  `clear` in interface `Message`

### getError

public MessageError getError()

Specified by:
  `getError` in interface `Message`

### toString

public String toString()

Overrides:
  `toString` in class `Object`