StringWriter stream = new StringWriter();
DumperOptions options = new DumperOptions();
options.setCanonical(canonical);
Emitter emitter = new Emitter(stream, options);
for (Event event : events) {
emitter.emit(event);
}
//
String data = stream.toString();
List<Event> newEvents = new ArrayList<Event>();
StreamReader reader = new StreamReader(data);