diff options
Diffstat (limited to 'java/common/Composite.tpl')
| -rw-r--r-- | java/common/Composite.tpl | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/java/common/Composite.tpl b/java/common/Composite.tpl index 450b1dea0e..eaaabdc041 100644 --- a/java/common/Composite.tpl +++ b/java/common/Composite.tpl @@ -13,6 +13,9 @@ import org.apache.qpid.transport.codec.Encoder; import org.apache.qpid.transport.network.Frame; +import org.apache.qpid.util.Strings; + + ${ from genutil import * @@ -227,6 +230,26 @@ if segments: setBody(body); return this; } + + public final byte[] getBodyBytes() { + ByteBuffer buf = getBody(); + byte[] bytes = new byte[buf.remaining()]; + buf.get(bytes); + return bytes; + } + + public final void setBody(byte[] body) + { + setBody(ByteBuffer.wrap(body)); + } + + public final String getBodyString() { + return Strings.fromUTF8(getBodyBytes()); + } + + public final void setBody(String body) { + setBody(Strings.toUTF8(body)); + } """) } |
