- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.fasterxml.jackson.dataformat.yaml.YAMLFactory.createGenerator()
方法的一些代码示例,展示了YAMLFactory.createGenerator()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YAMLFactory.createGenerator()
方法的具体详情如下:
包路径:com.fasterxml.jackson.dataformat.yaml.YAMLFactory
类名称:YAMLFactory
方法名:createGenerator
暂无
代码示例来源:origin: HubSpot/Singularity
@Override
public InputStream open(String path) throws IOException {
final JsonNode originalNode = objectMapper.readTree(yamlFactory.createParser(delegate.open(defaultConfigurationPath)));
final JsonNode overrideNode = objectMapper.readTree(yamlFactory.createParser(delegate.open(path)));
if (!(originalNode instanceof ObjectNode && overrideNode instanceof ObjectNode)) {
throw new SingularityConfigurationMergeException(String.format("Both %s and %s need to be YAML objects", defaultConfigurationPath, path));
}
merge((ObjectNode)originalNode, (ObjectNode)overrideNode);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
objectMapper.writeTree(yamlFactory.createGenerator(baos), originalNode);
return new ByteArrayInputStream(baos.toByteArray());
}
代码示例来源:origin: stackoverflow.com
YAMLFactory yf = new YAMLFactory();
ObjectMapper mapper = new ObjectMapper(yf);
ObjectNode root = (ObjectNode) mapper.readTree(yamlFileIn);
// modify root here
FileOutputStream fos = new FileOutputStream(yamlFileOut);
yf.createGenerator(fos).writeObject(root); // works. yay.
代码示例来源:origin: io.digdag/digdag-cli
public <T> void writeFile(File file, T value)
throws IOException
{
file.getParentFile().mkdirs();
// TODO use yaml if file path ends with dig or yml, otherwise use json?
try (YAMLGenerator out = yaml.createGenerator(new FileOutputStream(file))) {
// TODO write to a String first, then write to file. to not create partially-written broken file
mapper.writeValue(out, value);
}
}
代码示例来源:origin: io.digdag/digdag-cli
public <T> String toYaml(T value)
{
try {
StringWriter writer = new StringWriter();
try (YAMLGenerator out = yaml.createGenerator(writer)) {
mapper.writeValue(out, value);
}
return writer.toString();
}
catch (IOException ex) {
throw new RuntimeException(ex);
}
}
代码示例来源:origin: com.strapdata.elasticsearch/elasticsearch
@Override
public XContentGenerator createGenerator(OutputStream os, Set<String> includes, Set<String> excludes) throws IOException {
return new YamlXContentGenerator(yamlFactory.createGenerator(os, JsonEncoding.UTF8), os, includes, excludes);
}
代码示例来源:origin: org.seedstack.seed/seed-core
void writeDiagnosticReport(Map<String, Object> diagnosticInfo, Writer writer) throws IOException {
try (JsonGenerator jsonGenerator = YAML_FACTORY.createGenerator(writer)) {
jsonGenerator.setPrettyPrinter(DEFAULT_PRETTY_PRINTER);
jsonGenerator.writeObject(diagnosticInfo);
jsonGenerator.flush();
}
}
}
代码示例来源:origin: org.elasticsearch/elasticsearch-x-content
@Override
public XContentGenerator createGenerator(OutputStream os, Set<String> includes, Set<String> excludes) throws IOException {
return new YamlXContentGenerator(yamlFactory.createGenerator(os, JsonEncoding.UTF8), os, includes, excludes);
}
代码示例来源:origin: org.codelibs/elasticsearch-querybuilders
@Override
public XContentGenerator createGenerator(OutputStream os, Set<String> includes, Set<String> excludes) throws IOException {
return new YamlXContentGenerator(yamlFactory.createGenerator(os, JsonEncoding.UTF8), os, includes, excludes);
}
代码示例来源:origin: apache/servicemix-bundles
@Override
public XContentGenerator createGenerator(OutputStream os, Set<String> includes, Set<String> excludes) throws IOException {
return new YamlXContentGenerator(yamlFactory.createGenerator(os, JsonEncoding.UTF8), os, includes, excludes);
}
代码示例来源:origin: jillesvangurp/jsonj
public void serialize(Writer w, JsonElement e) {
try {
YAMLGenerator yaml = factory.createGenerator(w);
serialize(yaml, e);
yaml.flush();
} catch (IOException e1) {
throw new IllegalStateException(e1);
}
}
代码示例来源:origin: codehaus-cargo/cargo
/**
* Creates YAML generator instance.
* @return YAMLGenerator instance.
*/
private YAMLGenerator createYamlGenerator()
{
final Writer writer = new StringWriter();
YAMLFactory yamlFactory = new YAMLFactory();
yamlFactory.configure(YAMLGenerator.Feature.MINIMIZE_QUOTES, true);
yamlFactory.disable(YAMLGenerator.Feature.WRITE_DOC_START_MARKER);
try
{
return yamlFactory.createGenerator(writer);
}
catch (IOException ex)
{
throw new RuntimeException("Cannot create YAML generator.", ex);
}
}
}
代码示例来源:origin: com.hubspot/SingularityService
@Override
public InputStream open(String path) throws IOException {
final JsonNode originalNode = objectMapper.readTree(yamlFactory.createParser(delegate.open(defaultConfigurationPath)));
final JsonNode overrideNode = objectMapper.readTree(yamlFactory.createParser(delegate.open(path)));
if (!(originalNode instanceof ObjectNode && overrideNode instanceof ObjectNode)) {
throw new SingularityConfigurationMergeException(String.format("Both %s and %s need to be YAML objects", defaultConfigurationPath, path));
}
merge((ObjectNode)originalNode, (ObjectNode)overrideNode);
final ByteArrayOutputStream baos = new ByteArrayOutputStream();
objectMapper.writeTree(yamlFactory.createGenerator(baos), originalNode);
return new ByteArrayInputStream(baos.toByteArray());
}
代码示例来源:origin: io.digdag/digdag-standards
try (YAMLGenerator out = yaml.createGenerator(workspace.newOutputStream(tempFile), JsonEncoding.UTF8)) {
mapper.writeValue(out, embulkConfig);
我正在尝试将包从“com.fasterxml.jackson”重新定位到我自己的包(即“mypackage.com.fasterxml.jackson”),然后在我拥有的另一个 JAR 中使用它。 我
我将 jackson 库从 2.5.4 升级到 2.10.1,如下所示,我收到以下错误: "WFLYCTL0080: Failed services" => { "jboss.depl
我在 Wildfly 8.2.1 和 Glassfish 4.1 中使用 Spring Data JPA 部署 Spring MVC 应用程序时遇到问题(它在 Wildfly 10 中工作,但我不允许
问题如何指示ObjectMapper他应该通过某些条件(字段)过滤对象的嵌套集合。通过代码查看解释: 通过代码进行解释: 我必须将 Container 对象转换为 JSON。但我想根据 Entry.v
我有一个如下的dto public class MyClass { @JsonProperty("value") @JsonInclude(JsonInclude.Include.NO
有没有办法反序列化 JSON 数组 {["a", "b", 1]} 进入以下 Java 类 class MyObject { private String firstItem; private
How does Jackson deserialisation work when creating a Java object from JSON? A common conception is
我从代码中得到以下输出:{“列表”:[{“x”:“y”},{“a”:“b”}]} 相反,我想得到输出[{"x":"y"},{"a":"b"}] 代码如下。 public class Test { Li
我需要生成确认此 XSD 的 XML: 所以输出是这样的: A B C 问题是,如果我像这样在 Java bean 中注释变量: @JsonProperty("Line"
我有来自客户的 xml: 和简单的 Java 类 import com.fasterxml.jackson.dataformat.xml.annotation.Jackso
我已映射实体,并以 JSON 格式发送到服务。这是我的实体 @Entity @Table(name = "company") @JsonIdentityInfo(generator = ObjectI
以下类(class)显示问题 - 无法解决导入 com.fasterxml.jackson - import com.fasterxml.jackson.annotation.JsonIgnorePr
我的字符串是:json = {"foo":"bar"}{"foo":"bar"} ======================== ObjectMapper mapper = new ObjectMa
我有以下 JSON: "segmentid": { "mot": { "@displaytype": "B", "@type": "BLT",
我有这样的 csv 文件: headerA;headerB;headerC val1;val2;val3; val4;val5;val6; some_word;val7; 所以。最后一行不同。它不适合
我有以下 XML 架构: Intermediate A Intro to A Advanced B 我需要将其转换为 POJO 为: public class Schedu
我正在使用两个 JSON。 第一个具有字符串形式的 ID。 "details": { "id": "316.0" } 另一个的 ID 为 Integer。 "details": { "
当尝试序列化一个类别时,我得到一个 stackoverflow。 异常 Warning: StandardWrapperValve[dispatcher]: Servlet.service() for
在 maven pom.xml 中: com.fasterxml.jackson.core jackson-core 2.5.0
本文整理了Java中com.fasterxml.jackson.core.json.WriterBasedJsonGenerator类的一些代码示例,展示了WriterBasedJsonGenerat
我是一名优秀的程序员,十分优秀!