Guest User

Untitled

a guest
May 26th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. public MutableMessageSerializer {
  2. private ObjectMapper mapper = new ObjectMaper();
  3.  
  4. public static class MutableMessage {
  5. private String content;
  6.  
  7. public void setContent(String content) {
  8. this.content = content;
  9. }
  10.  
  11. public String getContent() {
  12. return this.content;
  13. }
  14. }
  15.  
  16. public MutableMessage deserialize(byte[] content) throws Exception {
  17. return mapper.readValue(content, MutableMessage.class);
  18. }
  19.  
  20. public byte[] serialize(MutableMessage message) throws Exception {
  21. return mapper.writeValueAsBytes(message);
  22. }
  23. }
Add Comment
Please, Sign In to add comment