Java 类org.codehaus.jackson.util.DefaultPrettyPrinter 实例源码

项目:lens    文件:BaseLensCommand.java   
/**
 * Instantiates a new base lens command.
 */
public BaseLensCommand() {
  mapper = new ObjectMapper();
  mapper.setSerializationInclusion(Inclusion.NON_NULL);
  mapper.setSerializationInclusion(Inclusion.NON_DEFAULT);
  pp = new DefaultPrettyPrinter();
  pp.indentObjectsWith(new Indenter() {
    @Override
    public void writeIndentation(JsonGenerator jg, int level) throws IOException {
      jg.writeRaw("\n");
      for (int i = 0; i < level; i++) {
        jg.writeRaw(" ");
      }
    }

    @Override
    public boolean isInline() {
      return false;
    }
  });
}
项目:scylla-tools-java    文件:JsonTransformer.java   
private JsonTransformer(JsonGenerator json, ISSTableScanner currentScanner, boolean rawTime, CFMetaData metadata)
{
    this.json = json;
    this.metadata = metadata;
    this.currentScanner = currentScanner;
    this.rawTime = rawTime;

    DefaultPrettyPrinter prettyPrinter = new DefaultPrettyPrinter();
    prettyPrinter.indentObjectsWith(objectIndenter);
    prettyPrinter.indentArraysWith(arrayIndenter);
    json.setPrettyPrinter(prettyPrinter);
}
项目:fiware-cosmos-ambari    文件:JsonSerializer.java   
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;
}
项目:fiware-cosmos-ambari    文件:JsonSerializer.java   
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;
}
项目:ldbc_snb_driver    文件:ResultsLogValidationSummary.java   
public String toJson()
{
    try
    {
        return new ObjectMapper().writer( new DefaultPrettyPrinter() ).writeValueAsString( this );
    }
    catch ( Exception e )
    {
        throw new RuntimeException( "Error serializing to JSON string", e );
    }
}
项目:ldbc_snb_driver    文件:DbValidationResult.java   
DbValidationResult( Db db )
{
    this.db = db;
    this.missingHandlersForOperationTypes = new HashSet<>();
    this.unableToExecuteOperations = new ArrayList<>();
    this.incorrectResultsForOperations = new ArrayList<>();
    this.successfullyExecutedOperationsPerOperationType = new HashMap<>();
    this.totalOperationsPerOperationType = new HashMap<>();
    this.objectMapper = new ObjectMapper();
    this.defaultPrettyPrinter = new DefaultPrettyPrinter();
    this.defaultPrettyPrinter.indentArraysWith( new DefaultPrettyPrinter.Lf2SpacesIndenter() );
}
项目:ldbc_snb_driver    文件:WorkloadResultsSnapshot.java   
public String toJson()
{
    try
    {
        return new ObjectMapper().writer( new DefaultPrettyPrinter() ).writeValueAsString( this );
    }
    catch ( Exception e )
    {
        System.out.println( ConcurrentErrorReporter.stackTraceToString( e ) );
        throw new RuntimeException( "Unable to generate parameter values string", e );
    }
}
项目:ditb    文件:JSONArrayMeasurementsExporter.java   
public JSONArrayMeasurementsExporter(OutputStream os) throws IOException {
  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
  g = factory.createJsonGenerator(bw);
  g.setPrettyPrinter(new DefaultPrettyPrinter());
  g.writeStartArray();
}
项目:ditb    文件:JSONMeasurementsExporter.java   
public JSONMeasurementsExporter(OutputStream os) throws IOException {

    BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
    g = factory.createJsonGenerator(bw);
    g.setPrettyPrinter(new DefaultPrettyPrinter());
  }
项目:12306-android-Decompile    文件:ObjectMapper.java   
protected PrettyPrinter _defaultPrettyPrinter()
{
  return new DefaultPrettyPrinter();
}
项目:12306-android-Decompile    文件:ObjectWriter.java   
public ObjectWriter withDefaultPrettyPrinter()
{
  return withPrettyPrinter(new DefaultPrettyPrinter());
}
项目:12306-android-Decompile    文件:JsonGeneratorBase.java   
public JsonGenerator useDefaultPrettyPrinter()
{
  return setPrettyPrinter(new DefaultPrettyPrinter());
}
项目:12306-android-Decompile    文件:ObjectMapper.java   
protected PrettyPrinter _defaultPrettyPrinter()
{
  return new DefaultPrettyPrinter();
}
项目:12306-android-Decompile    文件:ObjectWriter.java   
public ObjectWriter withDefaultPrettyPrinter()
{
  return withPrettyPrinter(new DefaultPrettyPrinter());
}
项目:12306-android-Decompile    文件:JsonGeneratorBase.java   
public JsonGenerator useDefaultPrettyPrinter()
{
  return setPrettyPrinter(new DefaultPrettyPrinter());
}
项目:ingress-indonesia-dev    文件:JsonGeneratorBase.java   
public JsonGenerator useDefaultPrettyPrinter()
{
  return setPrettyPrinter(new DefaultPrettyPrinter());
}