org.yaml.snakeyaml.events.CollectionEndEvent Java Examples
The following examples show how to use
org.yaml.snakeyaml.events.CollectionEndEvent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Emitter.java From orion.server with Eclipse Public License 1.0 | 6 votes |
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; }
Example #2
Source File: Emitter.java From snake-yaml with Apache License 2.0 | 6 votes |
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; }
Example #3
Source File: IndexYamlAbsoluteUrlRewriterSupport.java From nexus-repository-helm with Eclipse Public License 1.0 | 5 votes |
protected void updateUrls(final InputStream is, final OutputStream os) { try (Reader reader = new InputStreamReader(is); Writer writer = new OutputStreamWriter(os)) { Yaml yaml = new Yaml(); Emitter emitter = new Emitter(writer, new DumperOptions()); boolean rewrite = false; for (Event event : yaml.parse(reader)) { if (event instanceof ScalarEvent) { ScalarEvent scalarEvent = (ScalarEvent) event; if (rewrite) { event = maybeSetAbsoluteUrlAsRelative(scalarEvent); } else if (URLS.equals(scalarEvent.getValue())) { rewrite = true; } } else if (event instanceof CollectionStartEvent) { // NOOP } else if (event instanceof CollectionEndEvent) { rewrite = false; } emitter.emit(event); } } catch (IOException ex) { log.error("Error rewriting urls in index.yaml", ex); } }
Example #4
Source File: Emitter.java From Diorite with MIT License | 5 votes |
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); }