Package com.fasterxml.jackson.core

Examples of com.fasterxml.jackson.core.JsonGenerator.writeObject()


     *             If there is an IO error during serialization.
     */
    public static void write(Writer writer, Object jsonObject) throws JsonGenerationException,
            IOException {
        final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
        jw.writeObject(jsonObject);
    }

    /**
     * Writes the given JSON-LD Object out to the given Writer, using
     * indentation and new lines to improve readability.
View Full Code Here


     */
    public static void writePrettyPrint(Writer writer, Object jsonObject)
            throws JsonGenerationException, IOException {
        final JsonGenerator jw = JSON_FACTORY.createGenerator(writer);
        jw.useDefaultPrettyPrinter();
        jw.writeObject(jsonObject);
    }
}
View Full Code Here

    public String marshall(T obj) {
        try {
            JsonFactory jsonFactory = new MappingJsonFactory();
            StringWriter output = new StringWriter();
            JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(output);
            jsonGenerator.writeObject(obj);
            return output.toString();
        } catch ( Exception e ) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    public String marshall(T obj) {
        try {
            JsonFactory jsonFactory = new MappingJsonFactory();
            StringWriter output = new StringWriter();
            JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(output);
            jsonGenerator.writeObject(obj);
            return output.toString();
        } catch ( Exception e ) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    public String marshall(T obj) {
        try {
            JsonFactory jsonFactory = new MappingJsonFactory();
            StringWriter output = new StringWriter();
            JsonGenerator jsonGenerator = jsonFactory.createJsonGenerator(output);
            jsonGenerator.writeObject(obj);
            return output.toString();
        } catch ( Exception e ) {
            throw new RuntimeException(e);
        }
    }
View Full Code Here

    }

    public static void write(Writer w, Object jsonObject) throws JsonGenerationException,
            JsonMappingException, IOException {
        final JsonGenerator jw = JSON_FACTORY.createGenerator(w);
        jw.writeObject(jsonObject);
    }

    public static void writePrettyPrint(Writer w, Object jsonObject)
            throws JsonGenerationException, JsonMappingException, IOException {
        final JsonGenerator jw = JSON_FACTORY.createGenerator(w);
View Full Code Here

    public static void writePrettyPrint(Writer w, Object jsonObject)
            throws JsonGenerationException, JsonMappingException, IOException {
        final JsonGenerator jw = JSON_FACTORY.createGenerator(w);
        jw.useDefaultPrettyPrinter();
        jw.writeObject(jsonObject);
    }

    public static Object fromInputStream(InputStream content) throws IOException {
        return fromInputStream(content, "UTF-8"); // no readers from
                                                  // inputstreams w.o.
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.