当前位置: 首页>>代码示例>>Java>>正文


Java DefaultPrettyPrinter类代码示例

本文整理汇总了Java中org.codehaus.jackson.impl.DefaultPrettyPrinter的典型用法代码示例。如果您正苦于以下问题:Java DefaultPrettyPrinter类的具体用法?Java DefaultPrettyPrinter怎么用?Java DefaultPrettyPrinter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DefaultPrettyPrinter类属于org.codehaus.jackson.impl包,在下文中一共展示了DefaultPrettyPrinter类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createJsonGenerator

import org.codehaus.jackson.impl.DefaultPrettyPrinter; //导入依赖的package包/类
/**
 * 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;
}
 
开发者ID:rhli,项目名称:hadoop-EAR,代码行数:26,代码来源:CoronaSerializer.java

示例2: enableDisableJSONGeneratorFeature

import org.codehaus.jackson.impl.DefaultPrettyPrinter; //导入依赖的package包/类
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);
}
 
开发者ID:gemxd,项目名称:gemfirexd-oss,代码行数:8,代码来源:PdxToJSON.java

示例3: JSONMeasurementsExporter

import org.codehaus.jackson.impl.DefaultPrettyPrinter; //导入依赖的package包/类
public JSONMeasurementsExporter(OutputStream os) throws IOException
{

  BufferedWriter bw = new BufferedWriter(new OutputStreamWriter(os));
  g = factory.createJsonGenerator(bw);
  g.setPrettyPrinter(new DefaultPrettyPrinter());
}
 
开发者ID:SyncFree,项目名称:SwiftCloud,代码行数:8,代码来源:JSONMeasurementsExporter.java

示例4: serialize

import org.codehaus.jackson.impl.DefaultPrettyPrinter; //导入依赖的package包/类
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);
	}
}
 
开发者ID:iwethey,项目名称:iwethey,代码行数:16,代码来源:JacksonSerializer.java


注:本文中的org.codehaus.jackson.impl.DefaultPrettyPrinter类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。