Package com.fasterxml.jackson.core.util

Examples of com.fasterxml.jackson.core.util.MinimalPrettyPrinter


    public void testSimpleDocWithMinimal() throws Exception
    {
        StringWriter sw = new StringWriter();
        JsonGenerator gen = new JsonFactory().createGenerator(sw);
        // first with standard minimal
        gen.setPrettyPrinter(new MinimalPrettyPrinter());
        String docStr = _verifyPrettyPrinter(gen, sw);
        // which should have no linefeeds, tabs
        assertEquals(-1, docStr.indexOf('\n'));
        assertEquals(-1, docStr.indexOf('\t'));

        // And then with slightly customized variant
        gen = new JsonFactory().createGenerator(sw);
        gen.setPrettyPrinter(new MinimalPrettyPrinter() {
            @Override
            // use TAB between array values
            public void beforeArrayValues(JsonGenerator jg) throws IOException, JsonGenerationException
            {
                jg.writeRaw("\t");
View Full Code Here


  }

  @Provides
  @Singleton
  protected ObjectWriter objectWriter(ObjectMapper objectMapper) {
    return objectMapper.writer(prettyPrint ? new DefaultPrettyPrinter() : new MinimalPrettyPrinter());
  }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.util.MinimalPrettyPrinter

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.