Package org.yaml.snakeyaml.events

Examples of org.yaml.snakeyaml.events.StreamStartEvent


    }

    @JRubyMethod
    public IRubyObject start_stream(ThreadContext context, IRubyObject encoding) {
        // TODO: do something with encoding? perhaps at the stream level?
        StreamStartEvent event = new StreamStartEvent(NULL_MARK, NULL_MARK);
        emit(context, event);
        return this;
    }
View Full Code Here


            throw context.runtime.newTypeError(encoding, context.runtime.getFixnum());
        }

        initEmitter(context, encoding);

        StreamStartEvent event = new StreamStartEvent(NULL_MARK, NULL_MARK);

        emit(context, event);

        return this;
    }
View Full Code Here

    }

    // stream: STREAM-START document* STREAM-END
    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));
View Full Code Here

            } else if (className.equals("SequenceEndEvent")) {
                value = new SequenceEndEvent(null, null);
            } else if (className.equals("StreamEndEvent")) {
                value = new StreamEndEvent(null, null);
            } else if (className.equals("StreamStartEvent")) {
                value = new StreamStartEvent(null, null);
            } else {
                throw new UnsupportedOperationException();
            }
            return value;
        }
View Full Code Here

        String burger = new String(Character.toChars(0x1f354));
        String halfBurger = "\uD83C";
        StringWriter output = new StringWriter();
        Emitter emitter = new Emitter(output, options);

        emitter.emit(new StreamStartEvent(null, null));
        emitter.emit(new DocumentStartEvent(null, null, false, null, null));
        emitter.emit(new ScalarEvent(null, null, new ImplicitTuple(true, false), burger
                + halfBurger, null, null, '"'));
        String expected = "! \"\\U0001f354\\ud83c\"";
        assertEquals(expected, output.toString());
View Full Code Here

        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));
View Full Code Here

        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));
View Full Code Here

            throw context.runtime.newTypeError(encoding, context.runtime.getFixnum());
        }

        initEmitter(context, encoding);

        StreamStartEvent event = new StreamStartEvent(NULL_MARK, NULL_MARK);

        emit(context, event);

        return this;
    }
View Full Code Here

        this.explicitRoot = rootTag;
    }

    public void open() throws IOException {
        if (closed == null) {
            this.emitter.emit(new StreamStartEvent(null, null));
            this.closed = Boolean.FALSE;
        } else if (Boolean.TRUE.equals(closed)) {
            throw new SerializerException("serializer is closed");
        } else {
            throw new SerializerException("serializer is already opened");
View Full Code Here

     */
    private class ParseStreamStart implements Production {
        public Event produce() {
            // Parse the stream start.
            StreamStartToken token = (StreamStartToken) scanner.getToken();
            Event event = new StreamStartEvent(token.getStartMark(), token.getEndMark());
            // Prepare the next state.
            state = new ParseImplicitDocumentStart();
            return event;
        }
View Full Code Here

TOP

Related Classes of org.yaml.snakeyaml.events.StreamStartEvent

Copyright © 2018 www.massapicom. 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.