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 | 0fb1d150ed0489db09aca1b3653926356186ca7d (patch) | |
tree | dae84f52105cecf286ecc5c8e512e90fba4c7374 /java/common/src | |
parent | f4030cf72fcd7f50d7abf7a703e7772567052029 (diff) | |
download | qpid-python-0fb1d150ed0489db09aca1b3653926356186ca7d.tar.gz |
Moved timestamp encoding and decoding to class EncodingUtils.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid@452163 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/common/src')
-rw-r--r-- | java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java | 7 | ||||
-rw-r--r-- | java/common/src/org/apache/qpid/framing/EncodingUtils.java | 13 |
2 files changed, 15 insertions, 5 deletions
diff --git a/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java b/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java index 20eafa0be7..859fdac489 100644 --- a/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java +++ b/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/java/common/src/org/apache/qpid/framing/EncodingUtils.java b/java/common/src/org/apache/qpid/framing/EncodingUtils.java index f2f7a3b7a2..5b35044b25 100644 --- a/java/common/src/org/apache/qpid/framing/EncodingUtils.java +++ b/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). |