- 使用 Spring Initializr 创建 Spring Boot 应用程序
- 在Spring Boot中配置Cassandra
- 在 Spring Boot 上配置 Tomcat 连接池
- 将Camel消息路由到嵌入WildFly的Artemis上
本文整理了Java中com.esotericsoftware.yamlbeans.YamlReader.read()
方法的一些代码示例,展示了YamlReader.read()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。YamlReader.read()
方法的具体详情如下:
包路径:com.esotericsoftware.yamlbeans.YamlReader
类名称:YamlReader
方法名:read
[英]Reads the next YAML document and deserializes it into an object. The type of object is defined by the YAML tag. If there is no YAML tag, the object will be an ArrayList, HashMap, or String.
[中]读取下一个YAML文档并将其反序列化为对象。对象的类型由YAML标记定义。如果没有YAML标记,对象将是ArrayList、HashMap或字符串。
代码示例来源:origin: westnordost/StreetComplete
private List<Map.Entry<String,String>> readTranslators()
{
try
{
InputStream is = getResources().openRawResource(R.raw.credits_translations);
YamlReader reader = new YamlReader(new InputStreamReader(is));
Map yml = (Map) reader.read();
List<Map.Entry<String, String>> result = new ArrayList<>();
for (Object e : yml.entrySet())
{
result.add((Map.Entry<String, String>) e);
}
Collections.sort(result, (o1, o2) -> o1.getKey().compareTo(o2.getKey()));
return result;
} catch (YamlException e)
{
throw new RuntimeException(e);
}
}
}
代码示例来源:origin: westnordost/StreetComplete
private void parseConfig(InputStream config) throws YamlException
{
abbreviations = new HashMap<>();
YamlReader reader = new YamlReader(new InputStreamReader(config));
Map map = (Map) reader.read();
for(Object o : map.entrySet())
{
Map.Entry pair2 = (Map.Entry) o;
String abbreviation = ((String)pair2.getKey()).toLowerCase(locale);
String expansion = ((String) pair2.getValue()).toLowerCase(locale);
if(abbreviation.endsWith("$"))
{
abbreviation = abbreviation.substring(0, abbreviation.length() - 1) + "\\.?$";
}
else
{
abbreviation += "\\.?";
}
if(abbreviation.startsWith("..."))
{
abbreviation = "(\\w*)" + abbreviation.substring(3);
expansion = "$1" + expansion;
}
abbreviations.put(abbreviation, expansion);
}
}
代码示例来源:origin: westnordost/StreetComplete
private List<String> readContributors()
{
try
{
InputStream is = getResources().openRawResource(R.raw.credits_contributors);
YamlReader reader = new YamlReader(new InputStreamReader(is));
List<String> result = new ArrayList<>((List) reader.read());
result.add(getString(R.string.credits_and_more));
return result;
} catch (YamlException e)
{
throw new RuntimeException(e);
}
}
代码示例来源:origin: FlowCI/flow-platform
/**
* Yml To Map
* @param str
* @return
*/
public static Map ymlToMap(String str) {
Map result;
try {
YamlReader yamlReader = new YamlReader(str, yamlConfig);
result = (Map) yamlReader.read();
} catch (Throwable throwable) {
throw new YmlParseException(YML_ILLEGAL_MESSAGE);
}
return result;
}
代码示例来源:origin: westnordost/StreetComplete
private CountryInfo loadCountryInfo(String countryCodeIso3166) throws IOException
{
String filename = countryCodeIso3166+".yml";
InputStream is = null;
try
{
is = assetManager.open(BASEPATH + File.separator + filename);
Reader reader = new InputStreamReader(is, "UTF-8");
YamlReader yamlReader = new YamlReader(reader);
yamlReader.getConfig().setPrivateFields(true);
CountryInfo result = yamlReader.read(CountryInfo.class);
result.countryCode = countryCodeIso3166.split("-")[0];
return result;
}
finally
{
if(is != null) try
{
is.close();
}
catch (IOException ignore) { }
}
}
代码示例来源:origin: EsotericSoftware/yamlbeans
/** Reads the next YAML document and deserializes it into an object. The type of object is defined by the YAML tag. If there is
* no YAML tag, the object will be an {@link ArrayList}, {@link HashMap}, or String. */
public Object read () throws YamlException {
return read(null);
}
代码示例来源:origin: EsotericSoftware/yamlbeans
/** Reads an object of the specified type from YAML.
* @param type The type of object to read. If null, behaves the same as {{@link #read()}. */
public <T> T read (Class<T> type) throws YamlException {
return read(type, null);
}
代码示例来源:origin: com.esotericsoftware.yamlbeans/yamlbeans
/** Reads the next YAML document and deserializes it into an object. The type of object is defined by the YAML tag. If there is
* no YAML tag, the object will be an {@link ArrayList}, {@link HashMap}, or String. */
public Object read () throws YamlException {
return read(null);
}
代码示例来源:origin: com.esotericsoftware.yamlbeans/yamlbeans
/** Reads an object of the specified type from YAML.
* @param type The type of object to read. If null, behaves the same as {{@link #read()}. */
public <T> T read (Class<T> type) throws YamlException {
return read(type, null);
}
代码示例来源:origin: EsotericSoftware/yamlbeans
public static void main (String[] args) throws Exception {
YamlReader reader = new YamlReader(new FileReader("test/test.yml"));
System.out.println(reader.read());
}
}
代码示例来源:origin: com.esotericsoftware.yamlbeans/yamlbeans
public static void main (String[] args) throws Exception {
YamlReader reader = new YamlReader(new FileReader("test/test.yml"));
System.out.println(reader.read());
}
}
代码示例来源:origin: stackoverflow.com
YamlReader reader = new YamlReader(new FileReader("contact.yml"));
Object object = reader.read();
System.out.println(object);
Map map = (Map)object;
System.out.println(map.get("address"));
代码示例来源:origin: com.github.havardh/javaflow
public TypeMap(String filename) {
try (FileReader fileReader = new FileReader(filename)) {
YamlReader yamlReader = new YamlReader(fileReader);
map = (Map<String, String>)yamlReader.read();
} catch (FileNotFoundException e) {
map = emptyMap();
} catch (IOException e) {
throw new ExitException(ErrorCode.COULD_NOT_PARSE_TYPE_MAP, e);
}
}
代码示例来源:origin: com.sap.cloud.lm.sl/cloudfoundry-client-lib
protected TargetInfos getTokensFromFile() {
final File tokensFile = getTokensFile();
try {
YamlReader reader = new YamlReader(new FileReader(tokensFile));
return reader.read(TargetInfos.class);
} catch (FileNotFoundException fnfe) {
return new TargetInfos();
} catch (IOException e) {
throw new RuntimeException("An error occurred reading the tokens file at " + tokensFile.getPath() + ":" + e.getMessage(), e);
}
}
代码示例来源:origin: org.cloudfoundry/cloudfoundry-client-lib
protected TargetInfos getTokensFromFile() {
final File tokensFile = getTokensFile();
try {
YamlReader reader = new YamlReader(new FileReader(tokensFile));
return reader.read(TargetInfos.class);
} catch (FileNotFoundException fnfe) {
return new TargetInfos();
} catch (IOException e) {
throw new RuntimeException("An error occurred reading the tokens file at " +
tokensFile.getPath() + ":" + e.getMessage(), e);
}
}
代码示例来源:origin: io.cloudslang.tools/cs-content-packager-sources
public String getFullName() {
try {
final YamlReader yamlReader = new YamlReader(new StringReader(slangSource.getContent()));
final Optional<Object> namespace = simpleYPath(yamlReader.read(), "namespace", ".");
if (namespace.isPresent()) {
return format("%s.%s", namespace.get().toString(), getBaseName(slangSource.getName()));
}
} catch (YamlException exception) {
log.error("Failed to parse SL file.", exception);
}
return slangSource.getName();
}
代码示例来源:origin: io.cloudslang.tools/cs-content-packager-sources
public boolean isJavaOperation() {
final YamlReader yamlReader = new YamlReader(new StringReader(slangSource.getContent()));
try {
final Optional<Object> gavOpt = simpleYPath(yamlReader.read(),
"operation.java_action.gav", ".");
return gavOpt.isPresent();
} catch (YamlException e) {
return false;
}
}
代码示例来源:origin: mbechler/marshalsec
/**
* {@inheritDoc}
*
* @see marshalsec.MarshallerBase#unmarshal(java.lang.Object)
*/
@Override
public Object unmarshal ( String data ) throws Exception {
YamlConfig yc = new YamlConfig();
YamlReader r = new YamlReader(data, yc);
return r.read();
}
代码示例来源:origin: org.lorislab.hugoup/hugoup
public static <T> T readFile(String file, Class<T> clazz) throws Exception {
YamlConfig yamlConfig = new YamlConfig();
yamlConfig.readConfig.setClassTags(false);
YamlReader reader = new YamlReader(new FileReader(file));
return reader.read(clazz);
}
代码示例来源:origin: tomzo/gocd-yaml-config-plugin
public static Object readYamlObject(String path) throws IOException {
YamlConfig config = new YamlConfig();
config.setAllowDuplicates(false);
YamlReader reader = new YamlReader(TestUtils.createReader(path), config);
return reader.read();
}
我有一个阅读器,其中包含有关 51*51 网格的信息,其中网格上的每个点都由 f32 表示。 .我想将这些数据读入一个向量,以便我可以轻松处理它: pub fn from_reader(reader:
我重新启动了 SQL Server 2005 并运行了统计 IO 的查询。 我得到了这些结果:表“xxx”。扫描计数 1,逻辑读取 789,物理读取 3,预读读取 794,... 预读读取数是读取并放
在 CLHS 中,我为 :read-only x 读到:“当 x 为真时,这指定不能更改此插槽;它将始终包含构造时提供的值。” 我可以做到这一点(CCL、SBCL): CL-USER> (defstr
让我们考虑一下这句话(Total Store Ordering): reads are ordered before reads, writes before writes, and reads be
我正在开发一个 SMTP 库,它使用缓冲读取器通过网络读取行。 我想要一种安全的方式来从网络读取数据,而不依赖于 Rust 内部机制来确保代码按预期工作。具体来说,我想知道 Read trait 是否
我不清楚所有这些读取字符串函数之间的关系。嗯,很明显clojure.core/read-string可以读取 pr[n] 输出的任何序列化字符串甚至 print-dup .也很清楚clojure.ed
所以我做了这个功能,就像倒计时一样。我想在倒计时减少时读取命令。我的大问题是让 read() 在倒计时减少时等待输入。如您所见,我尝试使用 select() 但在第一个 printf 之后("time
这是我vue3+echart5 遇到的报错:Cannot read properties of undefined (reading ‘type‘) 这个问题需要搞清楚两个关键方法: toRaw: 作
下图中,左边是C代码,右边是未优化的LLVM IR形式。 The Figure 在 IR 上运行 MemoryDependenceAnalysis 可查找内存依赖性。原始代码及其 IR 等效代码中
这个问题在这里已经有了答案: Read values into a shell variable from a pipe (17 个答案) 关闭 3 年前。 我一直在尝试像这样从程序输出中读取环境变
当我输入相同的整数时,如何将整数转换为与使用 read(0,buff,nbytes) 获得的缓冲区相同的值/编码字符?我正在尝试编写类似 read() 的东西,但用整数数据代替读取到缓冲区的文件描述符
This question already has answers here: Closed 2 years ago. Read input in bash inside a while loop (
我正在尝试处理来自 MySQL 数据库的一些数据(主要是 double 值)。我收到此错误消息: Invalid attempt to access a field before calling Re
我正在制作一个简单的 TCP/IP 套接字应用 这样做有什么不同: DataInputStream in = new DataInputStream(clientSocket.getInputStre
我操作API服务器。 手机APP访问API服务器时,有时会出现该异常。 我尝试在测试服务器上进行测试,但无法重现。(我改变了apache和tomcat的连接时间。) 有什么问题?? 我该如何解决这个问
我在段落末尾使用“阅读更多”只是为了提醒像P.T.O一样的用户 为什么会有问题? 最佳答案 您必须明白,许多屏幕阅读器用户不会等到整个页面都读给他们听。他们使用键盘快捷键在页面中导航。 JAWS(可以
我已将我的 Angular 应用程序从 12 版本升级到 13 版本。我在单元测试运行期间开始遇到此错误。 Chrome Headless 94.0.4606.61 (Windows 10) AppC
我正在尝试为以下组件编写一个。我正在使用 queryParams 然后使用 switchmap 来调用服务。这是 url 的样子: http://localhost:4200/test-fee/det
我的代码有什么问题? Uncaught TypeError: Cannot read properties of undefined (reading 'remove') 和 Uncaught Typ
我在我的 React 应用程序中遇到了这个问题。 类型错误:无法读取未定义的属性(读取“requestContent”) 我在我的应用程序中使用 commercejs。代码指向 isEmpty=!ca
我是一名优秀的程序员,十分优秀!