gpt4 book ai didi

com.esotericsoftware.yamlbeans.YamlWriter.close()方法的使用及代码示例

转载 作者:知者 更新时间:2024-03-15 15:52:40 27 4
gpt4 key购买 nike

本文整理了Java中com.esotericsoftware.yamlbeans.YamlWriter.close()方法的一些代码示例,展示了YamlWriter.close()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlWriter.close()方法的具体详情如下:
包路径:com.esotericsoftware.yamlbeans.YamlWriter
类名称:YamlWriter
方法名:close

YamlWriter.close介绍

[英]Finishes writing any buffered output and releases all resources.
[中]完成写入任何缓冲输出并释放所有资源。

代码示例

代码示例来源:origin: org.lorislab.hugoup/hugoup

public static String toString(Object data) throws Exception {
  YamlConfig yamlConfig = new YamlConfig();
  yamlConfig.writeConfig.setWriteClassname(YamlConfig.WriteClassName.NEVER);
  StringWriter w = new StringWriter();
  YamlWriter writer = new YamlWriter(w, yamlConfig);
  writer.write(data);
  writer.close();          
  return w.toString();
}

代码示例来源:origin: dariober/ASCIIGenome

writer.close();

代码示例来源:origin: org.lorislab.hugoup/hugoup

public static void writeFile(String file, Object data) throws Exception {
    YamlConfig yamlConfig = new YamlConfig();
    yamlConfig.writeConfig.setWriteClassname(YamlConfig.WriteClassName.NEVER);
    YamlWriter writer = new YamlWriter(new FileWriter(file), yamlConfig);
    writer.write(data);
    writer.close();        
  }
}

代码示例来源:origin: audit4j/audit4j-core

/**
 * {@inheritDoc}
 * 
 */
@Override
public void generateConfig(T config, String filePath) throws ConfigurationException {
  YamlWriter writer;
  try {
    writer = new YamlWriter(new FileWriter(filePath));
    writer.getConfig().setClassTag(clazz.getSimpleName(), clazz);
    writer.write(Configuration.DEFAULT);
    writer.close();
  } catch (IOException e) {
    throw new ConfigurationException("Configuration Exception", "CONF_002");
  }
}

代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib

protected void saveTokensToFile(TargetInfos targetInfos) {
  final File tokensFile = getTokensFile();
  tokensFile.getParentFile().mkdirs();
  try {
    FileWriter fileWriter = new FileWriter(tokensFile);
    YamlConfig config = new YamlConfig();
    config.writeConfig.setAlwaysWriteClassname(false);
    config.writeConfig.setWriteRootElementTags(false);
    config.writeConfig.setWriteRootTags(false);
    config.writeConfig.setExplicitFirstDocument(true);
    YamlWriter yamlWriter = new YamlWriter(fileWriter, config);
    yamlWriter.write(targetInfos);
    yamlWriter.close();
    fileWriter.close();
  } catch (IOException e) {
    throw new RuntimeException("An error occurred writing the tokens file at " +
        tokensFile.getPath() + ":" + e.getMessage(), e);
  }
}

代码示例来源:origin: com.sap.cloud.lm.sl/cloudfoundry-client-lib

protected void saveTokensToFile(TargetInfos targetInfos) {
    final File tokensFile = getTokensFile();
    tokensFile.getParentFile()
      .mkdirs();
    try {
      FileWriter fileWriter = new FileWriter(tokensFile);

      YamlConfig config = new YamlConfig();
      config.writeConfig.setAlwaysWriteClassname(false);
      config.writeConfig.setWriteRootElementTags(false);
      config.writeConfig.setWriteRootTags(false);
      config.writeConfig.setExplicitFirstDocument(true);
      YamlWriter yamlWriter = new YamlWriter(fileWriter, config);

      yamlWriter.write(targetInfos);

      yamlWriter.close();
      fileWriter.close();
    } catch (IOException e) {
      throw new RuntimeException("An error occurred writing the tokens file at " + tokensFile.getPath() + ":" + e.getMessage(), e);
    }
  }
}

代码示例来源:origin: stackoverflow.com

YamlWriter writer = new YamlWriter(w);
writer.write(p1);
writer.close();

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com