diff options
| author | Kim van der Riet <kpvdr@apache.org> | 2007-01-17 19:49:40 +0000 |
|---|---|---|
| committer | Kim van der Riet <kpvdr@apache.org> | 2007-01-17 19:49:40 +0000 |
| commit | 844e632c013affdfd028704a195a746f6973ebb2 (patch) | |
| tree | 2a2fe63ad432e9dbeae557e5e30dc51654b9cdca /java/common | |
| parent | e6998705ab84f21e92595b0186958516165476f8 (diff) | |
| download | qpid-python-844e632c013affdfd028704a195a746f6973ebb2.tar.gz | |
Conversion of client/BasicMessageProducer to new Message class
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@497138 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common')
| -rw-r--r-- | java/common/src/main/java/org/apache/qpid/framing/Content.java | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/java/common/src/main/java/org/apache/qpid/framing/Content.java b/java/common/src/main/java/org/apache/qpid/framing/Content.java index bfc6ad6e87..d1d8c66995 100644 --- a/java/common/src/main/java/org/apache/qpid/framing/Content.java +++ b/java/common/src/main/java/org/apache/qpid/framing/Content.java @@ -24,7 +24,7 @@ import org.apache.mina.common.ByteBuffer; public class Content { - enum ContentTypeEnum + public enum ContentTypeEnum { CONTENT_TYPE_INLINE((byte)0), CONTENT_TYPE_REFERENCE((byte)1); private byte type; @@ -79,6 +79,19 @@ public class Content this.content = content.getBytes(); } + public Content(ContentTypeEnum contentType, ByteBuffer content) + { + if (contentType == ContentTypeEnum.CONTENT_TYPE_REFERENCE) + { + if (content == null) + throw new IllegalArgumentException("Content cannot be null for a ref type."); + if (content.array().length == 0) + throw new IllegalArgumentException("Content cannot be empty for a ref type."); + } + this.contentType = contentType; + this.content = content.array(); + } + // Get functions public ContentTypeEnum getContentType() { return contentType; } |
