Package org.yaml.snakeyaml

Examples of org.yaml.snakeyaml.Yaml.load()


  public ApiServer() {
    super();
    try {
      InputStream i = new FileInputStream(new File("../config.yaml"));
      Yaml yaml = new Yaml();
      Map config = (Map)yaml.load(i);
      System.out.println(config);
    } catch (java.io.FileNotFoundException e) {
    }
  }
View Full Code Here


    if (inputStream != null) {
      Yaml yaml = new Yaml();

      try {

        Object results = yaml.load(inputStream);

        if (results instanceof Map<?, ?>) {
          return (Map<Object, Object>) results;
        }
        else {
View Full Code Here

    this.reifier = new TypeReifier(values);
  }
 
  public IConstructor loadYAML(IString src, IEvaluatorContext ctx) {
    Yaml yaml = new Yaml();
    Object obj = yaml.load(src.getValue());
    if (obj == null) {
      throw RuntimeExceptionFactory.illegalArgument(src, ctx.getCurrentAST(), ctx.getStackTrace());
    }
    IdentityHashMap<Object, Integer> anchors = new IdentityHashMap<Object, Integer>();
    computeAnchors(obj, anchors, 0);
View Full Code Here

         
          // Render yaml file with
          String renderedYaml = TemplateLoader.load(yamlFile).render();
         
      Yaml yaml = new Yaml();
      Object o = yaml.load(renderedYaml);
      if (o instanceof LinkedHashMap<?, ?>) {
        LinkedHashMap<Object, Map<?, ?>> objects = (LinkedHashMap<Object, Map<?, ?>>) o;
        for (Object key : objects.keySet()) {
          Matcher matcher = keyPattern.matcher(key.toString().trim());
          if (matcher.matches()) {
View Full Code Here

        File f=new File(higopath,name);
        if(f.exists())
        {
             InputStreamReader isr = new InputStreamReader (new FileInputStream (f));
             Yaml yaml = new Yaml();
            Map ret = (Map) yaml.load(isr);
            if (ret != null)
            {
              return new HashMap(ret);
            }
        }
View Full Code Here

        else
          return new HashMap();
      }
      URL resource = (URL) resources.nextElement();
      Yaml yaml = new Yaml();
      Map ret = (Map) yaml.load(new InputStreamReader(resource
          .openStream()));
      if (ret == null)
      {
        ret = new HashMap();
      }
View Full Code Here

            URL resource = resources.iterator().next();
            Yaml yaml = new Yaml(new SafeConstructor());
            Map ret = null;
            InputStream input = resource.openStream();
            try {
                ret = (Map) yaml.load(new InputStreamReader(input));
            } finally {
                input.close();
            }
            if(ret==null) ret = new HashMap();
           
View Full Code Here

        RecordFormat format = new DelimitedRecordFormat()
                .withFieldDelimiter("|");

        Yaml yaml = new Yaml();
        InputStream in = new FileInputStream(args[1]);
        Map<String, Object> yamlConf = (Map<String, Object>) yaml.load(in);
        in.close();
        config.put("hdfs.config", yamlConf);

        HdfsBolt bolt = new HdfsBolt()
                .withConfigKey("hdfs.config")
View Full Code Here

        {
            final Constructor constructor = new Constructor(CliUserHelp.class);
            TypeDescription desc = new TypeDescription(CliUserHelp.class);
            desc.putListPropertyType("commands", CliCommandHelp.class);
            final Yaml yaml = new Yaml(new Loader(constructor));
            return (CliUserHelp)yaml.load(is);
        }
        finally
        {
            try
            {
View Full Code Here

        {
            final Constructor constructor = new Constructor(CliUserHelp.class);
            TypeDescription desc = new TypeDescription(CliUserHelp.class);
            desc.putListPropertyType("commands", CliCommandHelp.class);
            final Yaml yaml = new Yaml(new Loader(constructor));
            return (CliUserHelp) yaml.load(is);
        }
        finally
        {
            FileUtils.closeQuietly(is);
        }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.