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


Java MinimalPrettyPrinter类代码示例

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


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

示例1: AvroFileInputStream

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
public AvroFileInputStream(FileStatus status) throws IOException {
  pos = 0;
  buffer = new byte[0];
  GenericDatumReader<Object> reader = new GenericDatumReader<Object>();
  FileContext fc = FileContext.getFileContext(new Configuration());
  fileReader =
    DataFileReader.openReader(new AvroFSInput(fc, status.getPath()),reader);
  Schema schema = fileReader.getSchema();
  writer = new GenericDatumWriter<Object>(schema);
  output = new ByteArrayOutputStream();
  JsonGenerator generator =
    new JsonFactory().createJsonGenerator(output, JsonEncoding.UTF8);
  MinimalPrettyPrinter prettyPrinter = new MinimalPrettyPrinter();
  prettyPrinter.setRootValueSeparator(System.getProperty("line.separator"));
  generator.setPrettyPrinter(prettyPrinter);
  encoder = EncoderFactory.get().jsonEncoder(schema, generator);
}
 
开发者ID:nucypher,项目名称:hadoop-oss,代码行数:18,代码来源:Display.java

示例2: AvroFileInputStream

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
public AvroFileInputStream(FileStatus status) throws IOException {
  pos = 0;
  buffer = new byte[0];
  GenericDatumReader<Object> reader = new GenericDatumReader<Object>();
  fileReader =
    DataFileReader.openReader(new File(status.getPath().toUri()), reader);
  Schema schema = fileReader.getSchema();
  writer = new GenericDatumWriter<Object>(schema);
  output = new ByteArrayOutputStream();
  JsonGenerator generator =
    new JsonFactory().createJsonGenerator(output, JsonEncoding.UTF8);
  MinimalPrettyPrinter prettyPrinter = new MinimalPrettyPrinter();
  prettyPrinter.setRootValueSeparator(System.getProperty("line.separator"));
  generator.setPrettyPrinter(prettyPrinter);
  encoder = EncoderFactory.get().jsonEncoder(schema, generator);
}
 
开发者ID:ict-carch,项目名称:hadoop-plus,代码行数:17,代码来源:Display.java

示例3: getJsonGenerator

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
private static JsonGenerator getJsonGenerator(OutputStream out) throws IOException {
  if (null == out) {
    throw new NullPointerException("OutputStream cannot be null");
  }
  JsonGenerator g = new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
  MinimalPrettyPrinter pp = new MinimalPrettyPrinter();
  pp.setRootValueSeparator(System.getProperty("line.separator"));
  g.setPrettyPrinter(pp);
  return g;
}
 
开发者ID:HotelsDotCom,项目名称:jasvorno,代码行数:11,代码来源:JasvornoEncoder.java

示例4: writeEntities

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
/**
 * Write timeline entities to a file system
 * @param entities
 * @param logPath
 * @param fs
 * @throws IOException
 */
static void writeEntities(TimelineEntities entities, Path logPath,
    FileSystem fs) throws IOException {
  FSDataOutputStream outStream = createLogFile(logPath, fs);
  JsonGenerator jsonGenerator
      = (new JsonFactory()).createJsonGenerator(outStream);
  jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
  ObjectMapper objMapper = createObjectMapper();
  for (TimelineEntity entity : entities.getEntities()) {
    objMapper.writeValue(jsonGenerator, entity);
  }
  outStream.close();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:20,代码来源:PluginStoreTestUtils.java

示例5: writeEntitiesLeaveOpen

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
private void writeEntitiesLeaveOpen(TimelineEntities entities, Path logPath)
    throws IOException {
  if (outStream == null) {
    outStream = PluginStoreTestUtils.createLogFile(logPath, fs);
    jsonGenerator = (new JsonFactory()).createJsonGenerator(outStream);
    jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
  }
  for (TimelineEntity entity : entities.getEntities()) {
    objMapper.writeValue(jsonGenerator, entity);
  }
  outStream.hflush();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:13,代码来源:TestLogInfo.java

示例6: writeDomainLeaveOpen

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
private void writeDomainLeaveOpen(TimelineDomain domain, Path logPath)
    throws IOException {
  if (outStreamDomain == null) {
    outStreamDomain = PluginStoreTestUtils.createLogFile(logPath, fs);
  }
  // Write domain uses its own json generator to isolate from entity writers
  JsonGenerator jsonGeneratorLocal
      = (new JsonFactory()).createJsonGenerator(outStreamDomain);
  jsonGeneratorLocal.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
  objMapper.writeValue(jsonGeneratorLocal, domain);
  outStreamDomain.hflush();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:13,代码来源:TestLogInfo.java

示例7: getJsonGenerator

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
private static JsonGenerator getJsonGenerator(OutputStream out)
    throws IOException {
  if (null == out)
    throw new NullPointerException("OutputStream cannot be null"); 
  JsonGenerator g
    = new JsonFactory().createJsonGenerator(out, JsonEncoding.UTF8);
  MinimalPrettyPrinter pp = new MinimalPrettyPrinter();
  pp.setRootValueSeparator("\n");
  g.setPrettyPrinter(pp);
  return g;
}
 
开发者ID:openaire,项目名称:iis,代码行数:12,代码来源:HackedJsonEncoder.java

示例8: prepareForWrite

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
protected void prepareForWrite() throws IOException{
  this.stream = createLogFileStream(fs, logPath);
  this.jsonGenerator = new JsonFactory().createJsonGenerator(stream);
  this.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
  this.lastModifiedTime = System.currentTimeMillis();
}
 
开发者ID:aliyun-beta,项目名称:aliyun-oss-hadoop-fs,代码行数:7,代码来源:FileSystemTimelineWriter.java

示例9: prepareForWrite

import org.codehaus.jackson.util.MinimalPrettyPrinter; //导入依赖的package包/类
protected void prepareForWrite() throws IOException{
  this.stream = createLogFileStream(fs, logPath);
  this.jsonGenerator = new JsonFactory().createJsonGenerator(stream);
  this.jsonGenerator.setPrettyPrinter(new MinimalPrettyPrinter("\n"));
  this.lastModifiedTime = Time.monotonicNow();
}
 
开发者ID:hopshadoop,项目名称:hops,代码行数:7,代码来源:FileSystemTimelineWriter.java


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