Skip to content

Commit

Permalink
override protobuf serializer copy method (#314)
Browse files Browse the repository at this point in the history
  • Loading branch information
fengzanfeng authored and johnynek committed Aug 11, 2018
1 parent 84ab358 commit 5515ba8
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -76,5 +76,16 @@ public Message read(Kryo kryo, Input input, Class<Message> pbClass) {
throw new RuntimeException("Could not create " + pbClass, e);
}
}

@Override
public Message copy(Kryo kryo, Message original) {
try {
byte[] bytes = original.toByteArray();
return (Message)getParse(original.getClass()).invoke(null, bytes);
} catch (Exception exception) {
throw new RuntimeException("Copy message error.", exception);
}
}

}

0 comments on commit 5515ba8

Please sign in to comment.