当前位置: 首页>>代码示例>>Java>>正文


Java StreamReader.peek方法代码示例

本文整理汇总了Java中org.yaml.snakeyaml.reader.StreamReader.peek方法的典型用法代码示例。如果您正苦于以下问题:Java StreamReader.peek方法的具体用法?Java StreamReader.peek怎么用?Java StreamReader.peek使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.yaml.snakeyaml.reader.StreamReader的用法示例。


在下文中一共展示了StreamReader.peek方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: canonicalParse

import org.yaml.snakeyaml.reader.StreamReader; //导入方法依赖的package包/类
protected List<Event> canonicalParse(InputStream input2) throws IOException {
    StreamReader reader = new StreamReader(new UnicodeReader(input2));
    StringBuilder buffer = new StringBuilder();
    while (reader.peek() != '\0') {
        buffer.append(reader.peek());
        reader.forward();
    }
    CanonicalParser parser = new CanonicalParser(buffer.toString());
    List<Event> result = new ArrayList<Event>();
    while (parser.peekEvent() != null) {
        result.add(parser.getEvent());
    }
    input2.close();
    return result;
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:16,代码来源:PyImportTest.java

示例2: loadAll

import org.yaml.snakeyaml.reader.StreamReader; //导入方法依赖的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

示例3: canonical_compose_all

import org.yaml.snakeyaml.reader.StreamReader; //导入方法依赖的package包/类
private List<Node> canonical_compose_all(InputStream file) {
    StreamReader reader = new StreamReader(new UnicodeReader(file));
    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, new Resolver());
    List<Node> documents = new ArrayList<Node>();
    while (composer.checkNode()) {
        documents.add(composer.getNode());
    }
    return documents;
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:16,代码来源:PyStructureTest.java


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