storm-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bo...@apache.org
Subject [1/3] storm git commit: simple implemention for integer ser
Date Tue, 23 Feb 2016 20:32:08 GMT
Repository: storm
Updated Branches:
  refs/heads/master 53446108b -> adfd75b00


simple implemention for integer  ser

Project: http://git-wip-us.apache.org/repos/asf/storm/repo
Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/f7d59601
Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/f7d59601
Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/f7d59601

Branch: refs/heads/master
Commit: f7d59601ae54128ab9effa1baa8933d81b7e317b
Parents: 90e4f3e
Author: Xin Wang <best.wangxin@163.com>
Authored: Sat Jan 16 14:06:45 2016 +0800
Committer: Xin Wang <best.wangxin@163.com>
Committed: Sat Jan 16 14:06:45 2016 +0800

----------------------------------------------------------------------
 .../src/jvm/org/apache/storm/kafka/IntSerializer.java     | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/storm/blob/f7d59601/external/storm-kafka/src/jvm/org/apache/storm/kafka/IntSerializer.java
----------------------------------------------------------------------
diff --git a/external/storm-kafka/src/jvm/org/apache/storm/kafka/IntSerializer.java b/external/storm-kafka/src/jvm/org/apache/storm/kafka/IntSerializer.java
index 75f5563..0a2937b 100644
--- a/external/storm-kafka/src/jvm/org/apache/storm/kafka/IntSerializer.java
+++ b/external/storm-kafka/src/jvm/org/apache/storm/kafka/IntSerializer.java
@@ -30,10 +30,12 @@ public class IntSerializer implements Serializer<Integer> {
 
   @Override
   public byte[] serialize(String topic, Integer val) {
-    byte[] r = new byte[4];
-    IntBuffer b = ByteBuffer.wrap(r).asIntBuffer();
-    b.put(val);
-    return r;
+    return new byte[] {
+            (byte) (val >>> 24),
+            (byte) (val >>> 16),
+            (byte) (val >>> 8),
+            val.byteValue()
+        };
   }
 
   @Override


Mime
View raw message