Skip to content

Commit

Permalink
StreamEntry support Binary instead of String
Browse files Browse the repository at this point in the history
Revert

Add StreamEntryBinary

Revert format
  • Loading branch information
thachlp committed Sep 30, 2024
1 parent 5442642 commit 8582f4c
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions src/main/java/redis/clients/jedis/resps/StreamEntryBinary.java
Original file line number Diff line number Diff line change
@@ -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<byte[], byte[]> fields;

public StreamEntryBinary(StreamEntryID id, Map<byte[], byte[]> fields) {
this.id = id;
this.fields = fields;
}

public StreamEntryID getID() {
return id;
}

public Map<byte[], byte[]> 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<byte[], byte[]>) in.readUnshared();
}
}

0 comments on commit 8582f4c

Please sign in to comment.