Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public MutableMessageSerializer {
- private ObjectMapper mapper = new ObjectMaper();
- public static class MutableMessage {
- private String content;
- public void setContent(String content) {
- this.content = content;
- }
- public String getContent() {
- return this.content;
- }
- }
- public MutableMessage deserialize(byte[] content) throws Exception {
- return mapper.readValue(content, MutableMessage.class);
- }
- public byte[] serialize(MutableMessage message) throws Exception {
- return mapper.writeValueAsBytes(message);
- }
- }
Add Comment
Please, Sign In to add comment