• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Composer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.yaml.snakeyaml.composer.Composer的典型用法代码示例。如果您正苦于以下问题:Java Composer类的具体用法?Java Composer怎么用?Java Composer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Composer类属于org.yaml.snakeyaml.composer包,在下文中一共展示了Composer类的19个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: composeAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
/**
 * Parse all YAML documents in a stream and produce corresponding
 * representation trees.
 * 
 * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
 * @param yaml
 *            stream of YAML documents
 * @return parsed root Nodes for all the specified YAML documents
 */
public Iterable<Node> composeAll(Reader yaml) {
    final Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
    constructor.setComposer(composer);
    Iterator<Node> result = new Iterator<Node>() {
        public boolean hasNext() {
            return composer.checkNode();
        }

        public Node next() {
            return composer.getNode();
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
    return new NodeIterable(result);
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:28,代码来源:Yaml.java


示例2: loadAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
/**
 * Parse all YAML documents in a String and produce corresponding Java
 * objects. The documents are parsed only when the iterator is invoked.
 * 
 * @param yaml
 *            YAML data to load from (BOM must not be present)
 * @return an iterator over the parsed Java objects in this String in proper
 *         sequence
 */
public Iterable<Object> loadAll(Reader yaml) {
    Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
    constructor.setComposer(composer);
    Iterator<Object> result = new Iterator<Object>() {
        public boolean hasNext() {
            return constructor.checkData();
        }

        public Object next() {
            return constructor.getData();
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
    return new YamlIterable(result);
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:28,代码来源:Yaml.java


示例3: loadAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
/**
 * Parse all YAML documents in a String and produce corresponding Java
 * objects. The documents are parsed only when the iterator is invoked.
 *
 * @param yaml
 *            YAML data to load from (BOM must not be present)
 * @return an iterator over the parsed Java objects in this String in proper
 *         sequence
 */
public Iterable<Object> loadAll(Reader yaml) {
    Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
    constructor.setComposer(composer);
    Iterator<Object> result = new Iterator<Object>() {
        public boolean hasNext() {
            return constructor.checkData();
        }

        public Object next() {
            return constructor.getData();
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
    return new YamlIterable(result);
}
 
开发者ID:RoccoDev,项目名称:5zig-TIMV-Plugin,代码行数:28,代码来源:Yaml.java


示例4: composeAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
/**
 * Parse all YAML documents in a stream and produce corresponding
 * representation trees.
 *
 * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
 * @param yaml
 *            stream of YAML documents
 * @return parsed root Nodes for all the specified YAML documents
 */
public Iterable<Node> composeAll(Reader yaml) {
    final Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
    constructor.setComposer(composer);
    Iterator<Node> result = new Iterator<Node>() {
        public boolean hasNext() {
            return composer.checkNode();
        }

        public Node next() {
            return composer.getNode();
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
    return new NodeIterable(result);
}
 
开发者ID:RoccoDev,项目名称:5zig-TIMV-Plugin,代码行数:28,代码来源:Yaml.java


示例5: fromYaml

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
/**
 * Parse the only YAML document in a stream as configuration object.
 *
 * @param template
 *         template of config object.
 * @param io
 *         data to load from (BOM must not be present)
 * @param <T>
 *         type of config object.
 *
 * @return parsed object
 */
@SuppressWarnings("unchecked")
@Nullable
public <T extends Config> T fromYaml(ConfigTemplate<T> template, Reader io)
{
    ClassLoader old = Thread.currentThread().getContextClassLoader();
    if (old == null)
    {
        Thread.currentThread().setContextClassLoader(template.getConfigType().getClassLoader());
    }
    try
    {
        Composer composer = new Composer(new ParserImpl(new StreamReader(io)), new ConfigTemplateResolver(template));
        this.constructor.setComposer(composer);
        return (T) this.constructor.getSingleData(template.getConfigType());
    }
    finally
    {
        if (old == null)
        {
            Thread.currentThread().setContextClassLoader(null);
        }
    }
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:36,代码来源:Yaml.java


示例6: loadFromReader

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
@Nullable
private Object loadFromReader(StreamReader sreader, Class<?> type)
{
    ClassLoader old = Thread.currentThread().getContextClassLoader();
    if (old == null)
    {
        Thread.currentThread().setContextClassLoader(type.getClassLoader());
    }
    try
    {
        Composer composer = new Composer(new ParserImpl(sreader), this.resolver);
        this.constructor.setComposer(composer);
        return this.constructor.getSingleData(type);
    }
    finally
    {
        if (old == null)
        {
            Thread.currentThread().setContextClassLoader(null);
        }
    }
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:23,代码来源:Yaml.java


示例7: loadAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
@Override
public Iterable<Object> loadAll(Reader yaml) {
    StreamReader reader = new StreamReader(yaml);
    StringBuilder buffer = new StringBuilder();
    while (reader.peek() != '\0') {
        buffer.append(reader.peek());
        reader.forward();
    }
    CanonicalParser parser = new CanonicalParser(buffer.toString());
    Composer composer = new Composer(parser, resolver);
    this.constructor.setComposer(composer);
    Iterator<Object> result = new Iterator<Object>() {
        public boolean hasNext() {
            return constructor.checkData();
        }

        public Object next() {
            return constructor.getData();
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
    return new YamlIterable(result);
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:27,代码来源:PyStructureTest.java


示例8: load

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
@Override
public Object load(Reader yaml) {
    try {
        int ch = yaml.read();
        StringBuilder buffer = new StringBuilder();
        while (ch != -1) {
            buffer.append((char) ch);
            ch = yaml.read();
        }
        Composer composer = new Composer(new CanonicalParser(buffer.toString()), resolver);
        constructor.setComposer(composer);
        return constructor.getSingleData(Object.class);
    } catch (IOException e) {
        throw new YAMLException(e);
    }
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:17,代码来源:CanonicalLoader.java


示例9: compose_all

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
private List<Node> compose_all(InputStream file) {
    Composer composer = new Composer(new ParserImpl(new StreamReader(new UnicodeReader(file))),
            new Resolver());
    List<Node> documents = new ArrayList<Node>();
    while (composer.checkNode()) {
        documents.add(composer.getNode());
    }
    return documents;
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:10,代码来源:PyStructureTest.java


示例10: composeAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
public Iterable<Node> composeAll(StreamReader yaml) {
    final Composer composer = new Composer(new ParserImpl(yaml), resolver);
    constructor.setComposer(composer);
    final Iterator<Node> result = new Iterator<Node>() {
        public boolean hasNext() {
            return composer.checkNode();
        }

        public Node next() {
            return composer.getNode();
        }

        public void remove() {
            throw new UnsupportedOperationException();
        }
    };
    return new Iterable<Node>() {
        public Iterator<Node> iterator() {
            return result;
        }
    };
}
 
开发者ID:wtetzner,项目名称:kurgan,代码行数:23,代码来源:YamlUtils.java


示例11: loadAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
/**
 * Parse all YAML documents in a String and produce corresponding Java objects. The documents are parsed only when the iterator is
 * invoked.
 * 
 * @param yaml
 *            YAML data to load from (BOM must not be present)
 * @return an iterator over the parsed Java objects in this String in proper sequence
 */
public Iterable<Object> loadAll(final Reader yaml) {
	Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
	constructor.setComposer(composer);
	Iterator<Object> result = new Iterator<Object>() {
		@Override
		public boolean hasNext() {
			return constructor.checkData();
		}

		@Override
		public Object next() {
			return constructor.getData();
		}

		@Override
		public void remove() {
			throw new UnsupportedOperationException();
		}
	};
	return new YamlIterable(result);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:30,代码来源:Yaml.java


示例12: composeAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
/**
 * Parse all YAML documents in a stream and produce corresponding representation trees.
 * 
 * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a>
 * @param yaml
 *            stream of YAML documents
 * @return parsed root Nodes for all the specified YAML documents
 */
public Iterable<Node> composeAll(final Reader yaml) {
	final Composer composer = new Composer(new ParserImpl(new StreamReader(yaml)), resolver);
	constructor.setComposer(composer);
	Iterator<Node> result = new Iterator<Node>() {
		@Override
		public boolean hasNext() {
			return composer.checkNode();
		}

		@Override
		public Node next() {
			return composer.getNode();
		}

		@Override
		public void remove() {
			throw new UnsupportedOperationException();
		}
	};
	return new NodeIterable(result);
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:30,代码来源:Yaml.java


示例13: testFragment

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
public void testFragment() {
    String document = "foo:  blargle\n"
            + "developer:  { name: \"Bjarne Stroustrup\", language: \"C++\"}\n"
            + "gee:  [ \"whiz\", \"bang\"]\n";//

    StreamReader reader = new StreamReader(document);
    Composer composer = new FragmentComposer(new ParserImpl(reader), new Resolver(),
            "developer");
    Constructor constructor = new Constructor();
    constructor.setComposer(composer);
    DeveloperBean developer = (DeveloperBean) constructor.getSingleData(DeveloperBean.class);
    assertEquals("Bjarne Stroustrup", developer.name);
    assertEquals("C++", developer.language);
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:15,代码来源:FragmentComposerTest.java


示例14: construct

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
private Object construct(Constructor constructor, String data) {
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Resolver resolver = new Resolver();
    Composer composer = new Composer(parser, resolver);
    constructor.setComposer(composer);
    return constructor.getSingleData(Object.class);
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:9,代码来源:ConstructorMappingTest.java


示例15: construct

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private List<Object> construct(Constructor constructor, String data) {
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Resolver resolver = new Resolver();
    Composer composer = new Composer(parser, resolver);
    constructor.setComposer(composer);
    List<Object> result = (List<Object>) constructor.getSingleData(Object.class);
    return result;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:11,代码来源:ConstructorSequenceTest.java


示例16: loadAll

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
public Iterable<Object> loadAll(Reader yaml) {
    try {
        int ch = yaml.read();
        StringBuilder buffer = new StringBuilder();
        while (ch != -1) {
            buffer.append((char) ch);
            ch = yaml.read();
        }
        Composer composer = new Composer(new CanonicalParser(buffer.toString()), resolver);
        this.constructor.setComposer(composer);
        Iterator<Object> result = new Iterator<Object>() {
            public boolean hasNext() {
                return constructor.checkData();
            }

            public Object next() {
                return constructor.getData();
            }

            public void remove() {
                throw new UnsupportedOperationException();
            }
        };
        return new YamlIterable(result);
    } catch (IOException e) {
        throw new YAMLException(e);
    }
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:29,代码来源:CanonicalLoader.java


示例17: loadFromReader

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
private Object loadFromReader(StreamReader sreader, Class<?> type) {
    Composer composer = new Composer(new ParserImpl(sreader), resolver);
    constructor.setComposer(composer);
    return constructor.getSingleData(type);
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:6,代码来源:Yaml.java


示例18: setComposer

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
public void setComposer(Composer composer) {
    this.composer = composer;
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:4,代码来源:BaseConstructor.java


示例19: YamlComposerNodeIterator

import org.yaml.snakeyaml.composer.Composer; //导入依赖的package包/类
YamlComposerNodeIterator(Composer composer)
{
    this.composer = composer;
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:5,代码来源:YamlComposerNodeIterator.java



注:本文中的org.yaml.snakeyaml.composer.Composer类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Permission类代码示例发布时间:2022-05-22
下一篇:
Java SequenceEndEvent类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap