本文整理汇总了Java中org.codehaus.jackson.util.MinimalPrettyPrinter.setRootValueSeparator方法的典型用法代码示例。如果您正苦于以下问题:Java MinimalPrettyPrinter.setRootValueSeparator方法的具体用法?Java MinimalPrettyPrinter.setRootValueSeparator怎么用?Java MinimalPrettyPrinter.setRootValueSeparator使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.codehaus.jackson.util.MinimalPrettyPrinter
的用法示例。
在下文中一共展示了MinimalPrettyPrinter.setRootValueSeparator方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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);
}
示例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;
}
示例4: 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;
}