Examples of writeValueAsBytes()


Examples of com.netflix.suro.jackson.DefaultObjectMapper.writeValueAsBytes()

        String routingKey = "topicrecover";
        String index = "topicrecover";
        List<Message> msgList = new ArrayList<Message>();
        int msgCount = 100;
        for (int i = 0; i < msgCount; ++i) {
            msgList.add(new Message(routingKey, jsonMapper.writeValueAsBytes(msg)));
        }

        BulkRequest request = sink.createBulkRequest(msgList);
        for (int i = 0; i < msgCount; ++i) {
            sink.recover(i, request);
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper.writeValueAsBytes()

        serverView
    );

    Announcer announcer = new Announcer(remoteCf, Executors.newSingleThreadExecutor());
    announcer.start();
    announcer.announce(zkPathsConfig.getAnnouncementsPath() + "/" + me.getHost(), jsonMapper.writeValueAsBytes(me));

    BatchDataSegmentAnnouncer batchDataSegmentAnnouncer = EasyMock.createMock(BatchDataSegmentAnnouncer.class);
    BatchServerInventoryView batchServerInventoryView = EasyMock.createMock(BatchServerInventoryView.class);
    EasyMock.expect(batchServerInventoryView.getInventory()).andReturn(
        Arrays.asList(
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper.writeValueAsBytes()

                                          ).build();

    final ObjectMapper mapper = new DefaultObjectMapper();

    final TimeBoundaryQuery serdeQuery = mapper.readValue(
        mapper.writeValueAsBytes(
            mapper.readValue(
                mapper.writeValueAsString(
                    query
                ), TimeBoundaryQuery.class
            )
View Full Code Here

Examples of io.druid.jackson.DefaultObjectMapper.writeValueAsBytes()

                                          ).build();

    final ObjectMapper mapper = new DefaultObjectMapper();

    final TimeBoundaryQuery serdeQuery = mapper.readValue(
        mapper.writeValueAsBytes(
            mapper.readValue(
                mapper.writeValueAsString(
                    query
                ), TimeBoundaryQuery.class
            )
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writeValueAsBytes()

                                                       HttpResponseStatus.OK);
    sourcesResp.setHeader(HttpHeaders.Names.CONNECTION, HttpHeaders.Values.KEEP_ALIVE);
    sourcesResp.setHeader(HttpHeaders.Names.TRANSFER_ENCODING, HttpHeaders.Values.CHUNKED);
    ObjectMapper objMapper = new ObjectMapper();
    HttpChunk body =
        new DefaultHttpChunk(ChannelBuffers.wrappedBuffer(objMapper.writeValueAsBytes(String.valueOf(startScn))));
    NettyTestUtils.sendServerResponses(_dummyServer, clientAddr, sourcesResp, body);
  }

  static class DummyDatabusBootstrapConnectionStateMessage implements DatabusBootstrapConnectionStateMessage
  {
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writeValueAsBytes()

    public static final String REQUEST_PARAMETER_USERNAME = "username";

    public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
        return mapper.writeValueAsBytes(object);
    }
}
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writeValueAsBytes()

    public static final MediaType APPLICATION_JSON_UTF8 = new MediaType(MediaType.APPLICATION_JSON.getType(), MediaType.APPLICATION_JSON.getSubtype(), Charset.forName("utf8"));

    public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
        return mapper.writeValueAsBytes(object);
    }
}
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writeValueAsBytes()

    public static final String REQUEST_PARAMETER_USERNAME = "username";

    public static byte[] convertObjectToJsonBytes(Object object) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        mapper.setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
        return mapper.writeValueAsBytes(object);
    }
}
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writeValueAsBytes()

        //  {"name":"test1","id":1,"nodes":[{"name":"test2","id":2},{"name":"test3","id":3}]}
        objectMapper.getSerializationConfig().setSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);

        jsonObject = objectMapper.readValue(data, 0, data.length, JsonObject.class);

        return objectMapper.writeValueAsBytes(jsonObject);
    }

}
View Full Code Here

Examples of org.codehaus.jackson.map.ObjectMapper.writeValueAsBytes()

            user.setId(String.valueOf(idGenerator.incrementAndGet()));
        }

        entityManager.persist(user);

        return objectMapper.writeValueAsBytes(user);
    }

    public byte[] listUsers(byte[] req) throws IOException {
        ObjectMapper objectMapper = getJsonObjectMapper();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.