Examples of indentArraysWith()


Examples of org.codehaus.jackson.util.DefaultPrettyPrinter.indentArraysWith()

  private ByteArrayOutputStream init() throws IOException {
    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    m_generator = createJsonGenerator(bytesOut);

    DefaultPrettyPrinter p = new DefaultPrettyPrinter();
    p.indentArraysWith(new DefaultPrettyPrinter.Lf2SpacesIndenter());
    m_generator.setPrettyPrinter(p);

    return bytesOut;
  }
View Full Code Here

Examples of org.codehaus.jackson.util.DefaultPrettyPrinter.indentArraysWith()

  private JsonGenerator createJsonGenerator(ByteArrayOutputStream baos) throws IOException {
    JsonGenerator generator = m_factory.createJsonGenerator(new OutputStreamWriter(baos,
        Charset.forName("UTF-8").newEncoder()));

    DefaultPrettyPrinter p = new DefaultPrettyPrinter();
    p.indentArraysWith(new DefaultPrettyPrinter.Lf2SpacesIndenter());
    generator.setPrettyPrinter(p);

    return generator;
  }
View Full Code Here

Examples of org.codehaus.jackson.util.DefaultPrettyPrinter.indentArraysWith()

  private ByteArrayOutputStream init() throws IOException {
    ByteArrayOutputStream bytesOut = new ByteArrayOutputStream();
    m_generator = createJsonGenerator(bytesOut);

    DefaultPrettyPrinter p = new DefaultPrettyPrinter();
    p.indentArraysWith(new DefaultPrettyPrinter.Lf2SpacesIndenter());
    m_generator.setPrettyPrinter(p);

    return bytesOut;
  }
View Full Code Here

Examples of org.codehaus.jackson.util.DefaultPrettyPrinter.indentArraysWith()

  private JsonGenerator createJsonGenerator(ByteArrayOutputStream baos) throws IOException {
    JsonGenerator generator = m_factory.createJsonGenerator(new OutputStreamWriter(baos,
        Charset.forName("UTF-8").newEncoder()));

    DefaultPrettyPrinter p = new DefaultPrettyPrinter();
    p.indentArraysWith(new DefaultPrettyPrinter.Lf2SpacesIndenter());
    generator.setPrettyPrinter(p);

    return generator;
  }
View Full Code Here

Examples of org.codehaus.jackson.util.DefaultPrettyPrinter.indentArraysWith()

            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

Examples of org.codehaus.jackson.util.DefaultPrettyPrinter.indentArraysWith()

         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
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.