Package org.codehaus.jackson.util

Examples of org.codehaus.jackson.util.DefaultPrettyPrinter


            }
            StringWriter out = new StringWriter();

            // Create pretty printer:
            JsonGenerator gen = fac.createJsonGenerator(out);
            DefaultPrettyPrinter pp = new DefaultPrettyPrinter();
            pp.indentArraysWith(new DefaultPrettyPrinter.Lf2SpacesIndenter());
            gen.setPrettyPrinter(pp);

            // Now write:
            jsonObjMapper.writeTree(gen, node);
           
View Full Code Here


     *
     * @since 1.6
     */
    public ObjectWriter withDefaultPrettyPrinter()
    {
        return withPrettyPrinter(new DefaultPrettyPrinter());
    }
View Full Code Here

    }

    @Override
    public final JsonGenerator useDefaultPrettyPrinter()
    {
        return setPrettyPrinter(new DefaultPrettyPrinter());
    }
View Full Code Here

     *
     * @since 1.5
     */
    public ObjectWriter defaultPrettyPrintingWriter() {
        return new ObjectWriter(this, null, /*root type*/ null,
                new DefaultPrettyPrinter());
    }
View Full Code Here

         JsonFactory factory = new JsonFactory();
         JsonGenerator generator = factory.createJsonGenerator(out);
         ObjectMapper mapper = getMapper();
         mapper.setSerializationInclusion(Inclusion.NON_NULL);
         generator.setCodec(mapper);
         DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
         Indenter indenter = new Lf2SpacesIndenter();
         prettyPrinter.indentArraysWith(indenter);
         generator.setPrettyPrinter(prettyPrinter);
         generator.writeObject(object);
         writeEndingMsgToScreen(fileName);
      } finally {
         if (out != null && !(out instanceof PrintStream)) {
View Full Code Here

    {
        final ObjectMapper mapper = new ObjectMapper();
        final JsonGenerator generator = new JsonFactory().createJsonGenerator(writer);
        if (indent)
        {
            generator.setPrettyPrinter(new DefaultPrettyPrinter());
        }

        if (StringUtils.isNotBlank(callback))
        {
            writer.write(callback + "(");
View Full Code Here

        if (line.hasOption(RDAPOptions.RAW)) {
          ObjectMapper mapper = new ObjectMapper();
          System.out.println(mapper.writer().writeValueAsString(rdapClient.getDomainAsJson(query)));
        } else if (line.hasOption(RDAPOptions.PRETTY)) {
          ObjectMapper mapper = new ObjectMapper();
          System.out.println(mapper.writer(new DefaultPrettyPrinter()).writeValueAsString(rdapClient.getDomainAsJson(query)));
        }
      } catch (UnrecoverableKeyException e) {
        LOGGER.error(e.getMessage(), e);
      } catch (NoSuchAlgorithmException e) {
        LOGGER.error(e.getMessage(), e);
View Full Code Here

    public Api2JsonConverter()
    {
        this.objectMapper = new ObjectMapper();
        this.objectMapper.enable(Feature.INDENT_OUTPUT);
        this.jsonFactory = this.objectMapper.getJsonFactory();
        this.prettyPrinter = new DefaultPrettyPrinter();
    }
View Full Code Here

            format = uri.substring(uri.indexOf(".")+1);

        if (format != null) {
            if (format.equals("json")) {
                JsonGenerator gen = ApiHelper.getMapper().getJsonFactory().createJsonGenerator(response.getWriter());
                gen.setPrettyPrinter(new DefaultPrettyPrinter());
                ApiHelper.getMapper().writeValue(gen, list);
            }
        }
        else {
            getServletContext().getRequestDispatcher(VIEW_PATH).forward(request, response);
View Full Code Here

        this.logger  = Logger.getLogger(this.getClass());

        this.objectMapper = new ObjectMapper();
        this.objectMapper.enable(Feature.INDENT_OUTPUT);
        this.jsonFactory = this.objectMapper.getJsonFactory();
        this.prettyPrinter = new DefaultPrettyPrinter();
    }
View Full Code Here

TOP

Related Classes of org.codehaus.jackson.util.DefaultPrettyPrinter

Copyright © 2018 www.massapicom. 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.