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

项目:hadoop-EAR    文件:CoronaSerializer.java   
/**
 * This is a helper method which creates a JsonGenerator instance, for writing
 * the state of the ClusterManager to the state file. The JsonGenerator
 * instance writes to a compressed file if we have the compression flag
 * turned on.
 *
 * @param conf The CoronaConf instance to be used
 * @return The JsonGenerator instance to be used
 * @throws IOException
 */
public static JsonGenerator createJsonGenerator(CoronaConf conf)
  throws IOException {
  OutputStream outputStream = new FileOutputStream(conf.getCMStateFile());
  if (conf.getCMCompressStateFlag()) {
    outputStream = new GZIPOutputStream(outputStream);
  }
  ObjectMapper mapper = new ObjectMapper();
  JsonGenerator jsonGenerator =
    new JsonFactory().createJsonGenerator(outputStream, JsonEncoding.UTF8);
  jsonGenerator.setCodec(mapper);
  if (!conf.getCMCompressStateFlag()) {
    jsonGenerator.setPrettyPrinter(new DefaultPrettyPrinter());
  }
  return jsonGenerator;
}
项目:hadoop-EAR    文件:JsonUtils.java   
/**
 * This is a helper method which creates a JsonGenerator instance, for writing
 * the state of the ClusterManager to the state file. The JsonGenerator
 * instance writes to a compressed file if we have the compression flag
 * turned on.
 *
 * @param conf The CoronaConf instance to be used
 * @return The JsonGenerator instance to be used
 * @throws IOException
 */
public static JsonGenerator createJsonGenerator(CoronaConf conf)
  throws IOException {
  OutputStream outputStream = new FileOutputStream(conf.getCMStateFile());
  if (conf.getCMCompressStateFlag()) {
    outputStream = new GZIPOutputStream(outputStream);
  }
  ObjectMapper mapper = new ObjectMapper();
  JsonGenerator jsonGenerator =
    new JsonFactory().createJsonGenerator(outputStream, JsonEncoding.UTF8);
  jsonGenerator.setCodec(mapper);
  if (!conf.getCMCompressStateFlag()) {
    jsonGenerator.setPrettyPrinter(new DefaultPrettyPrinter());
  }
  return jsonGenerator;
}
项目:gemfirexd-oss    文件:PdxToJSON.java   
private void enableDisableJSONGeneratorFeature(JsonGenerator jg) {
  jg.enable(Feature.ESCAPE_NON_ASCII);
  jg.disable(Feature.AUTO_CLOSE_TARGET); 
  jg.setPrettyPrinter(new DefaultPrettyPrinter());
  if(PDXTOJJSON_UNQUOTEFIELDNAMES)
    jg.disable(Feature.QUOTE_FIELD_NAMES);
}
项目:gemfirexd-oss    文件:PdxToJSON.java   
private void enableDisableJSONGeneratorFeature(JsonGenerator jg) {
  jg.enable(Feature.ESCAPE_NON_ASCII);
  jg.disable(Feature.AUTO_CLOSE_TARGET); 
  jg.setPrettyPrinter(new DefaultPrettyPrinter());
  if(PDXTOJJSON_UNQUOTEFIELDNAMES)
    jg.disable(Feature.QUOTE_FIELD_NAMES);
}
项目:SwiftCloud    文件:JSONMeasurementsExporter.java   
public JSONMeasurementsExporter(OutputStream os) throws IOException
{

  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
  g = factory.createJsonGenerator(bw);
  g.setPrettyPrinter(new DefaultPrettyPrinter());
}
项目:iwethey    文件:JacksonSerializer.java   
public void serialize(Object obj, Writer out)
{
    try
    {
        JsonGenerator gen = this.factory.createJsonGenerator(out);
        gen.setPrettyPrinter(new DefaultPrettyPrinter());
        gen.writeObject(obj);
        gen.flush();
        out.flush();
    }
    catch (IOException e)
    {
        throw new JsonException(e);
    }
}
项目:hat-vldb2014-code    文件:JSONMeasurementsExporter.java   
public JSONMeasurementsExporter(OutputStream os) throws IOException
{

  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
  g = factory.createJsonGenerator(bw);
  g.setPrettyPrinter(new DefaultPrettyPrinter());
}
项目:bolton-sigmod2013-code    文件:JSONMeasurementsExporter.java   
public JSONMeasurementsExporter(OutputStream os) throws IOException
{

  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
  g = factory.createJsonGenerator(bw);
  g.setPrettyPrinter(new DefaultPrettyPrinter());
}