From 8582f4ce1b37baf7230f88494c17982eb246b6dc Mon Sep 17 00:00:00 2001 From: Thach Le Date: Sat, 6 Apr 2024 16:09:54 +0700 Subject: [PATCH] StreamEntry support Binary instead of String Revert Add StreamEntryBinary Revert format --- .../jedis/resps/StreamEntryBinary.java | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 src/main/java/redis/clients/jedis/resps/StreamEntryBinary.java diff --git a/src/main/java/redis/clients/jedis/resps/StreamEntryBinary.java b/src/main/java/redis/clients/jedis/resps/StreamEntryBinary.java new file mode 100644 index 00000000000..1cc0ea360c1 --- /dev/null +++ b/src/main/java/redis/clients/jedis/resps/StreamEntryBinary.java @@ -0,0 +1,43 @@ +package redis.clients.jedis.resps; + +import redis.clients.jedis.StreamEntryID; + +import java.io.IOException; +import java.io.Serializable; +import java.util.Map; + +public class StreamEntryBinary implements Serializable { + + private static final long serialVersionUID = 1L; + + private StreamEntryID id; + private Map fields; + + public StreamEntryBinary(StreamEntryID id, Map fields) { + this.id = id; + this.fields = fields; + } + + public StreamEntryID getID() { + return id; + } + + public Map getFields() { + return fields; + } + + @Override + public String toString() { + return id + " " + fields; + } + + private void writeObject(java.io.ObjectOutputStream out) throws IOException { + out.writeUnshared(this.id); + out.writeUnshared(this.fields); + } + + private void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException { + this.id = (StreamEntryID) in.readUnshared(); + this.fields = (Map) in.readUnshared(); + } +}