/** * Parse a YAML stream and produce parsing events. * * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a> * @param yaml * YAML document(s) * @return parsed events */ public Iterable<Event> parse(Reader yaml) { final Parser parser = new ParserImpl(new StreamReader(yaml)); Iterator<Event> result = new Iterator<Event>() { public boolean hasNext() { return parser.peekEvent() != null; } public Event next() { return parser.getEvent(); } public void remove() { throw new UnsupportedOperationException(); } }; return new EventIterable(result); }
protected List<Event> parse(InputStream input) throws IOException { StreamReader reader = new StreamReader(new UnicodeReader(input)); Parser parser = new ParserImpl(reader); List<Event> result = new ArrayList<Event>(); while (parser.peekEvent() != null) { result.add(parser.getEvent()); } input.close(); return result; }
/** * Parse a YAML stream and produce parsing events. * * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a> * @param yaml * YAML document(s) * @return parsed events */ public Iterable<Event> parse(final Reader yaml) { final Parser parser = new ParserImpl(new StreamReader(yaml)); Iterator<Event> result = new Iterator<Event>() { @Override public boolean hasNext() { return parser.peekEvent() != null; } @Override public Event next() { return parser.getEvent(); } @Override public void remove() { throw new UnsupportedOperationException(); } }; return new EventIterable(result); }
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); }
@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; }
public Composer(Parser parser, Resolver resolver) { this.parser = parser; this.resolver = resolver; this.anchors = new HashMap<String, Node>(); this.recursiveNodes = new HashSet<Node>(); }
YamlParserEventIterator(Parser parser) { this.parser = parser; }
public FragmentComposer(Parser parser, Resolver resolver, String nodeName) { super(parser, resolver); this.nodeName = nodeName; }
public Composer(final Parser parser, final Resolver resolver) { this.parser = parser; this.resolver = resolver; this.anchors = new HashMap<String, Node>(); this.recursiveNodes = new HashSet<Node>(); }
/** * Parse a YAML stream and produce parsing events. * * @param yaml * YAML document(s) * * @return parsed events * * @see <a href="http://yaml.org/spec/1.1/#id859333">Processing Overview</a> */ public Iterable<Event> parse(Reader yaml) { Parser parser = new ParserImpl(new StreamReader(yaml)); Iterator<Event> result = new YamlParserEventIterator(parser); return new YamlEventIterable(result); }