Author: kpvdr
Date: Mon Oct 2 11:24:52 2006
New Revision: 452163
URL: http://svn.apache.org/viewvc?view=rev&rev=452163
Log:
Moved timestamp encoding and decoding to class EncodingUtils.
Modified:
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java
Modified:
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java?view=diff&rev=452163&r1=452162&r2=452163
==============================================================================
---
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java
(original)
+++
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/BasicContentHeaderProperties.java
Mon Oct 2 11:24:52 2006
@@ -218,8 +218,7 @@
}
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 @@
}
if ((_propertyFlags & (1 << 6)) > 0)
{
- // Discard msb from AMQ timestamp
- buffer.getUnsignedInt();
- _timestamp = buffer.getUnsignedInt();
+ _timestamp = EncodingUtils.readTimestamp(buffer);
}
if ((_propertyFlags & (1 << 5)) > 0)
{
Modified:
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java
URL:
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java?view=diff&rev=452163&r1=452162&r2=452163
==============================================================================
---
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java
(original)
+++
incubator/qpid/trunk/qpid/java/common/src/org/apache/qpid/framing/EncodingUtils.java
Mon Oct 2 11:24:52 2006
@@ -255,6 +255,12 @@
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)
{
@@ -345,6 +351,13 @@
buffer.get(result);
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