org.yelong.support.yaml.YamlWrapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of yelong-support Show documentation
Show all versions of yelong-support Show documentation
对各种开源框架的包装、支持、拓展。这里也包含的yelong-core与orm框架的整合。
默认对所有依赖为 scope 为 provided 。您需要针对自己的需要进行再次依赖
/**
*
*/
package org.yelong.support.yaml;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import org.yaml.snakeyaml.Yaml;
/**
* @author PengFei
*/
public class YamlWrapper {
private final Yaml yaml;
public YamlWrapper() {
this(new Yaml());
}
public YamlWrapper(Yaml yaml) {
this.yaml = yaml;
}
public YamlProperties load(String yaml) throws FileNotFoundException {
return load(new File(yaml));
}
public YamlProperties load(File file) throws FileNotFoundException {
return new DefaultYamlProperties(file.getName(), yaml.load(new FileInputStream(file)));
}
public YamlProperties load(InputStream is) {
return new DefaultYamlProperties( yaml.load(is)) ;
}
public Yaml getYaml() {
return yaml;
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy