Package com.fasterxml.jackson.databind

Examples of com.fasterxml.jackson.databind.ObjectWriter.writeValueAsBytes()


                ExternalMetrics metrics = _gatherMetrics(now, full);
                ObjectWriter w = _jsonWriter;
                if (_indent.get()) {
                  w = w.withDefaultPrettyPrinter();
                }
                final byte[] raw = w.writeValueAsBytes(metrics);
                ser = new SerializedMetrics(now, raw);
                _cachedMetrics.set(ser);
            }
            response = (ServletServiceResponse) response.ok()
                    .setContentTypeJson();
View Full Code Here


              writer = defaultObjectWriter;
            }

            byte[] bytes;
            try {
              bytes = writer.writeValueAsBytes(object.getObject());
            } catch (JsonProcessingException e) {
              context.error(e);
              return;
            }
View Full Code Here

        CsvSchema schema = mapper.schemaFor(Entry.class);
        ObjectWriter writer = mapper.writer(schema);
        mapper.disable(CsvParser.Feature.WRAP_AS_ARRAY);

        // First, using bytes; note
        byte[] bytes = writer.writeValueAsBytes(entries);
        // ... we just happen to know this is expected length...
        final int EXPECTED_BYTES = 97640;
        assertEquals(EXPECTED_BYTES, bytes.length);

        MappingIterator<Entry> it = mapper.reader(Entry.class).with(schema).readValues(bytes, 0, bytes.length);
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.