zoukankan      html  css  js  c++  java
  • java读取YAML文件

    loadString:
      type:link
      locater:kw  
    rootLocation: root
    timeout: 15

    package com.test;

    import org.ho.yaml.Yaml;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileNotFoundException;
    import java.util.HashMap;
    import org.testng.Assert;



    public class Test2 {

        /**
         * @param args
         */
        
        public void getTest() {
            Assert.assertEquals(1,2);
            System.out.println("1234");
        }
        
        public void getYamlFile() throws FileNotFoundException{    
            File f = new File("src/com/test/Test2.yaml");
            System.out.println(f.getAbsolutePath());
            HashMap ml = Yaml.loadType(new FileInputStream(f.getAbsolutePath()), HashMap.class);
            System.out.println(ml.size());        
            System.out.println(((HashMap) ml.get("loadString")).get("locater"));        
        }
        public static void main(String[] args) throws FileNotFoundException {
            Test2 t = new Test2();        
            t.getYamlFile();
        }

    }

  • 相关阅读:
    Linq用法笔记
    关于Json的总结
    关于Json的总结
    Managing uniquely tagged items using the internet
    关于Json的总结
    Net中Session的用法
    Net中Session的用法
    Net中Session的用法
    【基础】Asp.Net操作Cookie总结
    Asp.Net操作Cookie总结
  • 原文地址:https://www.cnblogs.com/zhangfei/p/2714429.html
Copyright © 2011-2022 走看看