Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 package com.fasterxml.clustermate.json;
 
 import java.io.*;
 
 
Jackson-based Converter implementation; added in this package since API module does not depend on Jackson.
    protected final ObjectReader _reader;
    protected final ObjectWriter _writer;
    public ClusterMessageConverter(ObjectMapper mapper)
    {
         = mapper.reader(ClusterStatusMessage.class);
         = mapper.writerWithType(ClusterStatusMessage.class);
    }
    
    @Override
    public ClusterStatusMessage fromJSON(InputStream inthrows IOException {
        return .readValue(in);
    }
    
    @Override
    public ClusterStatusMessage fromJSON(byte[] msgint offsetint lenthrows IOException {
        return .readValue(msgoffsetlen);
    }
    
    @Override
    public void asJSON(ClusterStatusMessage msgOutputStream outthrows IOException {
        .writeValue(outmsg);
    }
    @Override
    public byte[] asJSONBytes(ClusterStatusMessage msgOutputStream outthrows IOException {
        return .writeValueAsBytes(msg);
    }
New to GrepCode? Check out our FAQ X