diff options
| author | Kim van der Riet <kpvdr@apache.org> | 2006-10-02 18:24:52 +0000 |
|---|---|---|
| committer | Kim van der Riet <kpvdr@apache.org> | 2006-10-02 18:24:52 +0000 |
| commit | a6ab93f8d33850f8446d6d5b3b1530ad79240b66 (patch) | |
| tree | e64d20ba48497b740360ef21ec941e71e66f42e6 /qpid/java | |
| parent | 199204cb2b7b3c651dc22a3016534b7acd6fa8aa (diff) | |
| download | qpid-python-a6ab93f8d33850f8446d6d5b3b1530ad79240b66.tar.gz | |
Moved timestamp encoding and decoding to class EncodingUtils.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk@452163 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java')
| -rw-r--r-- | qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java | 7 | ||||
| -rw-r--r-- | qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java | 13 |
2 files changed, 15 insertions, 5 deletions
diff --git a/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java b/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java index 20eafa0be7..859fdac489 100644 --- a/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java +++ b/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java @@ -218,8 +218,7 @@ public class BasicContentHeaderProperties implements ContentHeaderProperties } if ((_propertyFlags & (1 << 6)) > 0) { - EncodingUtils.writeUnsignedInteger(buffer, 0/*timestamp msb*/); - EncodingUtils.writeUnsignedInteger(buffer, _timestamp); + EncodingUtils.writeTimestamp(buffer, _timestamp); } if ((_propertyFlags & (1 << 5)) > 0) { @@ -301,9 +300,7 @@ public class BasicContentHeaderProperties implements ContentHeaderProperties } if ((_propertyFlags & (1 << 6)) > 0) { - // Discard msb from AMQ timestamp - buffer.getUnsignedInt(); - _timestamp = buffer.getUnsignedInt(); + _timestamp = EncodingUtils.readTimestamp(buffer); } if ((_propertyFlags & (1 << 5)) > 0) { diff --git a/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java b/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java index f2f7a3b7a2..5b35044b25 100644 --- a/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java +++ b/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java @@ -255,6 +255,12 @@ public class EncodingUtils writeUnsignedInteger(buffer, 0); } } + + public static void writeTimestamp(ByteBuffer buffer, long timestamp) + { + writeUnsignedInteger(buffer, 0/*timestamp msb*/); + writeUnsignedInteger(buffer, timestamp); + } public static boolean[] readBooleans(ByteBuffer buffer) { @@ -346,6 +352,13 @@ public class EncodingUtils return result; } } + + public static long readTimestamp(ByteBuffer buffer) + { + // Discard msb from AMQ timestamp + buffer.getUnsignedInt(); + return buffer.getUnsignedInt(); + } // Will barf with a NPE on a null input. Not sure whether it should return null or // an empty field-table (which would be slower - perhaps unnecessarily). |
