Package org.codehaus.jackson.map

Examples of org.codehaus.jackson.map.ObjectMapper.writerWithDefaultPrettyPrinter()


  private String prettyPrintIfJson(String maybeJson) {
    JsonFactory factory = new JsonFactory();
    ObjectMapper mapper = new ObjectMapper(factory);
    TypeReference<HashMap<String,Object>> typeRef = new TypeReference<HashMap<String,Object>>() {};
    try {
      return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(mapper.readValue(maybeJson, typeRef));
    }
    catch (IOException e) {
      // Not JSON? Return unchanged
      return maybeJson;
    }
View Full Code Here


      getLog().info("Writing results into " + outputFile.getName());
     
      try {
        ObjectMapper objectMapper = new ObjectMapper();
       
        ObjectWriter writer = objectMapper.writerWithDefaultPrettyPrinter();
       
        writer.writeValue(outputFile, result.getEnvironments());
      } catch (Exception e) {
        throw new RuntimeException(e);
      }
View Full Code Here

    float tps = ticks * 1000f / timeProfiled;
    tables.add(0, CollectionsUtil.map(
        "TPS", tps,
        "Load", TableFormatter.formatDoubleWithPrecision((MinecraftServer.getTickTime() * 100) / MinecraftServer.getTargetTickTime(), 2)
    ));
    objectMapper.writerWithDefaultPrettyPrinter().writeValue(file, tables);
  }

  public TableFormatter writeStringData(TableFormatter tf) {
    return writeStringData(tf, 5);
  }
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.