gpt4 book ai didi

org.ho.yaml.Yaml类的使用及代码示例

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

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

Yaml介绍

暂无

代码示例

代码示例来源:origin: mbechler/marshalsec

/**
 * {@inheritDoc}
 *
 * @see marshalsec.MarshallerBase#unmarshal(java.lang.Object)
 */
@Override
public Object unmarshal ( String data ) throws Exception {
  return Yaml.loadType(data, Object.class);
}

代码示例来源:origin: mbechler/marshalsec

/**
 * {@inheritDoc}
 *
 * @see marshalsec.MarshallerBase#marshal(java.lang.Object)
 */
@Override
public String marshal ( Object o ) throws Exception {
  return Yaml.dump(o);
}

代码示例来源:origin: redBorder/cep

/**
 * This method updates de instance attribute map with the data loaded
 * from the file configFile
 */
public void reload() {
  try {
    map = (Map<String, Object>) Yaml.load(new File(configFile));
  } catch (FileNotFoundException e) {
    log.error("Couldn't find config file {}", configFile);
    System.exit(1);
  } catch (YamlException e) {
    log.error("Couldn't read config file {}. Is it a YAML file?", configFile);
    System.exit(1);
  }
}

代码示例来源:origin: woothee/woothee-java

buffer.append("    Map<String,String> h;\n");
List datasetEntries = (List) Yaml.load(source);

代码示例来源:origin: org.jvnet.hudson/selenium-grid-hub-standalone

protected static GridConfiguration parse(Reader yamlDefinition) {
  return Yaml.loadType(yamlDefinition, GridConfiguration.class);
}

代码示例来源:origin: org.openqa.selenium.grid/selenium-grid-core

public String toYAML() {
  return Yaml.dump(this, true);
}

代码示例来源:origin: org.seleniumhq.selenium.grid/selenium-grid-core

protected static GridConfiguration parse(Reader yamlDefinition) {
  return Yaml.loadType(yamlDefinition, GridConfiguration.class);
}

代码示例来源:origin: org.jvnet.hudson/selenium-grid-hub-standalone

public String toYAML() {
  return Yaml.dump(this, true);
}

代码示例来源:origin: org.openqa.selenium.grid/selenium-grid-core

protected static GridConfiguration parse(Reader yamlDefinition) {
  return Yaml.loadType(yamlDefinition, GridConfiguration.class);
}

代码示例来源:origin: org.seleniumhq.selenium.grid/selenium-grid-core

public String toYAML() {
  return Yaml.dump(this, true);
}

代码示例来源:origin: com.github.hackerwin7/jlib-utils

/**
   * read yaml file and return the value
   * @param fileName
   * @param key
   * @return value string
   * @throws Exception
   */
  public static String readYaml(String fileName, String key) throws Exception {
    HashMap map = Yaml.loadType(FileUtils.class.getClassLoader().getResource(fileName).openStream(), HashMap.class);
    return map.get(key).toString();
  }
}

代码示例来源:origin: org.mnode.mstor/mstor

/**
   * {@inheritDoc}
   */
  protected void save() throws DelegateException {
//        FileOutputStream fout = null;
    try {
      Yaml.dump(folderExt, getFile(), true);
//            fout = new FileOutputStream(getFile());
//            yamlConfig.dump(folderExt, fout);
    }
    catch (IOException ioe) {
      throw new DelegateException("Error saving metadata", ioe);
    }
//        finally {
//            if (fout != null) {
//                try {
//                    fout.close();
//                }
//                catch (IOException ioe) {}
//            }
//        }
  }

代码示例来源:origin: com.gitee.sherlockholmnes/goge-core

/**
 * 根据文件路径 获取yml配置文件
 *
 * @param path 路径
 * @return str
 */
public static String readYml(String path) throws Exception {
  InputStream inputStream = null;
  try {
    inputStream = FileUtil.class.getResourceAsStream(path);
    HashMap testEntity = org.ho.yaml.Yaml.loadType(inputStream, HashMap.class);//如果是读入Map,这里不可以写Map接口,必须写实现
    return JSON.toJSONString(testEntity);
  } catch (Exception e) {
    logger.error("", e);
    throw e;
  } finally {
    try{
      inputStream.close();
    } catch (Exception e){
    }
  }
}

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