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

Java StreamEndEvent类代码示例

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

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



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

示例1: needEvents

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
private boolean needEvents(int count) {
    int level = 0;
    Iterator<Event> iter = events.iterator();
    iter.next();
    while (iter.hasNext()) {
        Event event = iter.next();
        if (event instanceof DocumentStartEvent || event instanceof CollectionStartEvent) {
            level++;
        } else if (event instanceof DocumentEndEvent || event instanceof CollectionEndEvent) {
            level--;
        } else if (event instanceof StreamEndEvent) {
            level = -1;
        }
        if (level < 0) {
            return false;
        }
    }
    return events.size() < count + 1;
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:20,代码来源:Emitter.java


示例2: testGetEvent

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void testGetEvent() {
    String data = "string: abcd";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "string",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "abcd",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    check(etalonEvents, parser);
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:20,代码来源:ParserImplTest.java


示例3: testGetEvent2

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void testGetEvent2() {
    String data = "american:\n  - Boston Red Sox";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents
            .add(new MappingStartEvent(null, null, true, dummyMark, dummyMark, Boolean.TRUE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "american",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false),
            "Boston Red Sox", dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    check(etalonEvents, parser);
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:23,代码来源:ParserImplTest.java


示例4: testGetEvent

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void testGetEvent() {
    String data = "string: abcd";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents.add(new MappingStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "string",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "abcd",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    while (parser.checkEvent(null)) {
        Event event = parser.getEvent();
        if (etalonEvents.isEmpty()) {
            fail("unexpected event: " + event);
        }
        assertEquals(etalonEvents.removeFirst(), event);
    }
    assertFalse("Must contain no more events: " + parser.getEvent(), parser.checkEvent(null));
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:27,代码来源:ParserImplTest.java


示例5: close

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void close() throws IOException {
    if (closed == null) {
        throw new SerializerException("serializer is not opened");
    } else if (!Boolean.TRUE.equals(closed)) {
        this.emitter.emit(new StreamEndEvent(null, null));
        this.closed = Boolean.TRUE;
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:9,代码来源:Serializer.java


示例6: needEvents

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
private boolean needEvents(int count)
{
    int level = 0;
    Iterator<Event> iter = this.events.iterator();
    iter.next();
    while (iter.hasNext())
    {
        Event event = iter.next();
        if ((event instanceof DocumentStartEvent) || (event instanceof CollectionStartEvent))
        {
            level++;
        }
        else if ((event instanceof DocumentEndEvent) || (event instanceof CollectionEndEvent))
        {
            level--;
        }
        else if (event instanceof StreamEndEvent)
        {
            level = - 1;
        }
        if (level < 0)
        {
            return false;
        }
    }
    return this.events.size() < (count + 1);
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:28,代码来源:Emitter.java


示例7: close

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void close() throws IOException
{
    if (this.closed == null)
    {
        throw new SerializerException("serializer is not opened");
    }
    else if (! Boolean.TRUE.equals(this.closed))
    {
        this.emitter.emit(new StreamEndEvent(null, null));
        this.closed = Boolean.TRUE;
    }
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:13,代码来源:Serializer.java


示例8: parseStream

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
private void parseStream() {
    scanner.getToken(Token.ID.StreamStart);
    events.add(new StreamStartEvent(null, null));
    while (!scanner.checkToken(Token.ID.StreamEnd)) {
        if (scanner.checkToken(Token.ID.Directive, Token.ID.DocumentStart)) {
            parseDocument();
        } else {
            throw new CanonicalException("document is expected, got " + scanner.tokens.get(0));
        }
    }
    scanner.getToken(Token.ID.StreamEnd);
    events.add(new StreamEndEvent(null, null));
}
 
开发者ID:bmoliveira,项目名称:snake-yaml,代码行数:14,代码来源:CanonicalParser.java


示例9: testParse

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void testParse() {
    Yaml yaml = new Yaml();
    Event e = null;
    int counter = 0;
    for (Event event : yaml.parse(new StringReader("abc: 56"))) {
        if (e == null) {
            assertTrue(event instanceof StreamStartEvent);
        }
        e = event;
        counter++;
    }
    assertTrue(e instanceof StreamEndEvent);
    assertEquals(8, counter);
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:15,代码来源:YamlParseTest.java


示例10: testParseManyDocuments

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void testParseManyDocuments() {
    Yaml yaml = new Yaml();
    Event e = null;
    int counter = 0;
    for (Event event : yaml.parse(new StringReader("abc: 56\n---\n4\n---\nqwe\n"))) {
        if (e == null) {
            assertTrue(event instanceof StreamStartEvent);
        }
        e = event;
        counter++;
    }
    assertTrue(e instanceof StreamEndEvent);
    assertEquals(14, counter);
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:15,代码来源:YamlParseTest.java


示例11: testGetEvent2

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void testGetEvent2() {
    String data = "american:\n  - Boston Red Sox";
    StreamReader reader = new StreamReader(data);
    Parser parser = new ParserImpl(reader);
    Mark dummyMark = new Mark("dummy", 0, 0, 0, "", 0);
    LinkedList<Event> etalonEvents = new LinkedList<Event>();
    etalonEvents.add(new StreamStartEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentStartEvent(dummyMark, dummyMark, false, null, null));
    etalonEvents
            .add(new MappingStartEvent(null, null, true, dummyMark, dummyMark, Boolean.TRUE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false), "american",
            dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceStartEvent(null, null, true, dummyMark, dummyMark,
            Boolean.FALSE));
    etalonEvents.add(new ScalarEvent(null, null, new ImplicitTuple(true, false),
            "Boston Red Sox", dummyMark, dummyMark, (char) 0));
    etalonEvents.add(new SequenceEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new MappingEndEvent(dummyMark, dummyMark));
    etalonEvents.add(new DocumentEndEvent(dummyMark, dummyMark, false));
    etalonEvents.add(new StreamEndEvent(dummyMark, dummyMark));
    while (parser.checkEvent(null)) {
        Event event = parser.getEvent();
        if (etalonEvents.isEmpty()) {
            fail("unexpected event: " + event);
        }
        assertEquals(etalonEvents.removeFirst(), event);
    }
    assertFalse("Must contain no more events: " + parser.getEvent(), parser.checkEvent(null));
}
 
开发者ID:cuizhennan,项目名称:snakeyaml,代码行数:30,代码来源:ParserImplTest.java


示例12: close

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void close() throws IOException {
	if (closed == null) {
		throw new SerializerException("serializer is not opened");
	} else if (!Boolean.TRUE.equals(closed)) {
		this.emitter.emit(new StreamEndEvent(null, null));
		this.closed = Boolean.TRUE;
	}
}
 
开发者ID:OpenNTF,项目名称:org.openntf.domino,代码行数:9,代码来源:Serializer.java


示例13: expect

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void expect() throws IOException {
    if (event instanceof DocumentStartEvent) {
        DocumentStartEvent ev = (DocumentStartEvent) event;
        if ((ev.getVersion() != null || ev.getTags() != null) && openEnded) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        if (ev.getVersion() != null) {
            String versionText = prepareVersion(ev.getVersion());
            writeVersionDirective(versionText);
        }
        tagPrefixes = new LinkedHashMap<String, String>(DEFAULT_TAG_PREFIXES);
        if (ev.getTags() != null) {
            Set<String> handles = new TreeSet<String>(ev.getTags().keySet());
            for (String handle : handles) {
                String prefix = ev.getTags().get(handle);
                tagPrefixes.put(prefix, handle);
                String handleText = prepareTagHandle(handle);
                String prefixText = prepareTagPrefix(prefix);
                writeTagDirective(handleText, prefixText);
            }
        }
        boolean implicit = first && !ev.getExplicit() && !canonical
                && ev.getVersion() == null
                && (ev.getTags() == null || ev.getTags().isEmpty())
                && !checkEmptyDocument();
        if (!implicit) {
            writeIndent();
            writeIndicator("---", true, false, false);
            if (canonical) {
                writeIndent();
            }
        }
        state = new ExpectDocumentRoot();
    } else if (event instanceof StreamEndEvent) {
        // TODO fix 313 PyYAML changeset
        // if (openEnded) {
        // writeIndicator("...", true, false, false);
        // writeIndent();
        // }
        writeStreamEnd();
        state = new ExpectNothing();
    } else {
        throw new EmitterException("需要 DocumentStartEvent 事件, 但却得到了 " + event);
    }
}
 
开发者ID:imkiva,项目名称:AndroidApktool,代码行数:47,代码来源:Emitter.java


示例14: expect

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public void expect() throws IOException {
    if (event instanceof DocumentStartEvent) {
        DocumentStartEvent ev = (DocumentStartEvent) event;
        if ((ev.getVersion() != null || ev.getTags() != null) && openEnded) {
            writeIndicator("...", true, false, false);
            writeIndent();
        }
        if (ev.getVersion() != null) {
            String versionText = prepareVersion(ev.getVersion());
            writeVersionDirective(versionText);
        }
        tagPrefixes = new LinkedHashMap<String, String>(DEFAULT_TAG_PREFIXES);
        if (ev.getTags() != null) {
            Set<String> handles = new TreeSet<String>(ev.getTags().keySet());
            for (String handle : handles) {
                String prefix = ev.getTags().get(handle);
                tagPrefixes.put(prefix, handle);
                String handleText = prepareTagHandle(handle);
                String prefixText = prepareTagPrefix(prefix);
                writeTagDirective(handleText, prefixText);
            }
        }
        boolean implicit = first && !ev.getExplicit() && !canonical
                && ev.getVersion() == null
                && (ev.getTags() == null || ev.getTags().isEmpty())
                && !checkEmptyDocument();
        if (!implicit) {
            writeIndent();
            writeIndicator("---", true, false, false);
            if (canonical) {
                writeIndent();
            }
        }
        state = new ExpectDocumentRoot();
    } else if (event instanceof StreamEndEvent) {
        // TODO fix 313 PyYAML changeset
        // if (openEnded) {
        // writeIndicator("...", true, false, false);
        // writeIndent();
        // }
        writeStreamEnd();
        state = new ExpectNothing();
    } else {
        throw new EmitterException("expected DocumentStartEvent, but got " + event);
    }
}
 
开发者ID:RoccoDev,项目名称:5zig-TIMV-Plugin,代码行数:47,代码来源:Emitter.java


示例15: expect

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public static void expect(Emitter emitter, boolean first) throws IOException
{
    if (emitter.event instanceof DocumentStartEvent)
    {
        DocumentStartEvent ev = (DocumentStartEvent) emitter.event;
        if (((ev.getVersion() != null) || (ev.getTags() != null)) && emitter.openEnded)
        {
            emitter.writeIndicator("...", true, false, false);
            emitter.writeIndent();
        }
        if (ev.getVersion() != null)
        {
            String versionText = emitter.prepareVersion(ev.getVersion());
            emitter.writeVersionDirective(versionText);
        }
        emitter.tagPrefixes = new LinkedHashMap<>(Emitter.DEFAULT_TAG_PREFIXES);
        if (ev.getTags() != null)
        {
            Set<String> handles = new TreeSet<>(ev.getTags().keySet());
            for (String handle : handles)
            {
                String prefix = ev.getTags().get(handle);
                emitter.tagPrefixes.put(prefix, handle);
                String handleText = emitter.prepareTagHandle(handle);
                String prefixText = emitter.prepareTagPrefix(prefix);
                emitter.writeTagDirective(handleText, prefixText);
            }
        }
        boolean implicit =
                first && ! ev.getExplicit() && ! emitter.canonical && (ev.getVersion() == null) && ((ev.getTags() == null) || ev.getTags().isEmpty()) &&
                ! emitter.checkEmptyDocument();
        if (! implicit)
        {
            emitter.writeIndent();
            emitter.writeIndicator("---", true, false, false);
            if (emitter.canonical)
            {
                emitter.writeIndent();
            }
        }
        emitter.state = new ExpectDocumentRoot();
    }
    else if (emitter.event instanceof StreamEndEvent)
    {
        // TODO fix 313 PyYAML changeset
        // if (openEnded) {
        // writeIndicator("...", true, false, false);
        // writeIndent();
        // }
        emitter.writeStreamEnd();
        emitter.state = new ExpectNothing();
    }
    else
    {
        throw new EmitterException("expected DocumentStartEvent, but got " + emitter.event);
    }
}
 
开发者ID:GotoFinal,项目名称:diorite-configs-java8,代码行数:58,代码来源:ExpectDocumentStart.java


示例16: expectStreamEnd

import org.yaml.snakeyaml.events.StreamEndEvent; //导入依赖的package包/类
public StreamEndEvent expectStreamEnd() {
	return (StreamEndEvent) expect(Event.ID.StreamEnd);
}
 
开发者ID:petercipov,项目名称:mobi,代码行数:4,代码来源:YamlConfigParser.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Java AccessorProperty类代码示例发布时间:2022-05-22
下一篇:
Java ArrayIterator类代码示例发布时间: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