Package org.yaml.snakeyaml

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


    public Map<Index,IndexStatistics> load(File file, boolean statsIgnoreMissingIndexes) throws IOException {
        Map<Index,IndexStatistics> result = new TreeMap<>(INDEX_NAME_COMPARATOR);
        Yaml yaml = new Yaml();
        FileInputStream istr = new FileInputStream(file);
        try {
            for (Object doc : yaml.loadAll(istr)) {
                parseStatistics(doc, result, statsIgnoreMissingIndexes);
            }
        }
        finally {
            istr.close();
View Full Code Here


    @Override
    public void loadInto(ServiceConfigurationHandler config) {
        try {
            Yaml parser = new Yaml();
            for (Enumerated<Object> enumerated : EnumeratingIterator.of(parser.loadAll(source))) {
                Object item = enumerated.get();
                if ( ! (item instanceof List) ) {
                    throw new BadConfigurationException("block " + enumerated.count() + " of " + sourceName, item);
                }
                readBlock(config, enumerated.count(), (List<?>)item);
View Full Code Here

    private void test(Reader in) {
        List<?> sequence = null;
        try {
            Yaml yaml = new Yaml(new RegisterTags());
            for(Object yamlObject : yaml.loadAll(in)) {
                RegisterTags.LinedObject linedDocument = (RegisterTags.LinedObject) yamlObject;
                Object document = linedDocument.getObject();
                lineNumber = linedDocument.getStartMark().getLine();
                ++commandNumber;
                commandName = null;
View Full Code Here

        FileReader fileReader = new FileReader(SIMPLE_TEST);
        try {
            ParameterizationBuilder pb = new ParameterizationBuilder();
            BufferedReader buffered = new BufferedReader(fileReader);
            Yaml yaml = new Yaml();
            for (Object objRaw : yaml.loadAll(buffered)) {
                List<?> asList = (List<?>) objRaw;
                for (Object lineRaw : asList) {
                    Map<?,?> line = (Map<?,?>) lineRaw;
                    if (line.size() != 1)
                        throw new RuntimeException("need key-val pair:" + line);
View Full Code Here

                reader = new FileReader(file);
            } else {
                reader = new InputStreamReader(inputStream);
            }
            try {
                for (final Object o : yaml.loadAll(reader)) {
                    if (o instanceof Map) {

                        //name->{node data} map
                        final Map<String, Map<String, Object>> map = (Map<String, Map<String, Object>>) o;
                        for (final Map.Entry<String, Map<String, Object>> entry : map.entrySet()) {
View Full Code Here

        final Yaml yaml = new Yaml();
        this.file = file;
        final FileInputStream stream = new FileInputStream(this.file);
        int index=1;
        try {
            for (Object yamlDoc : yaml.loadAll(stream)) {
                final Object yamlDoc1 = yamlDoc;
                if (yamlDoc1 instanceof Map) {
                    try {
                        YamlPolicy yamlPolicy = new YamlPolicy((Map) yamlDoc1, file, index);
                        all.add(yamlPolicy);
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.