@Test void symbols() throws Exception { Configuration config = Configuration.builder() .addSymbol(new Symbol(ASTERISK, 'X')) .addSymbol(new Symbol(COLON, ';', ":", false, true)) .addSymbol(new Symbol(SEMICOLON, ':', ";&", true, false)).build(); exporter.export(config, out); assertEquals( "<redpen-conf lang=\"en\">\n" + " <symbols>\n" + " <symbol name=\"ASTERISK\" value=\"X\"/>\n" + " <symbol name=\"COLON\" value=\";\" invalid-chars=\":\" after-space=\"true\"/>\n" + " <symbol name=\"SEMICOLON\" value=\":\" invalid-chars=\";&amp;\" before-space=\"true\"/>\n" + " </symbols>\n" + "</redpen-conf>", out.toString()); }
public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } } }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }  }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }  void export(Configuration config, OutputStream out); }
ConfigurationExporter { public void export(Configuration config, OutputStream out) { try { XMLOutputFactory sf = XMLOutputFactory.newInstance(); XMLStreamWriter sax = new IndentingXMLStreamWriter(sf.createXMLStreamWriter(new OutputStreamWriter(out, UTF_8))); addRoot(config, sax); addValidators(config.getValidatorConfigs(), sax); addNonDefaultSymbols(config.getSymbolTable(), sax); sax.writeEndElement(); sax.flush(); } catch (XMLStreamException e) { throw new RuntimeException(e); } }  void export(Configuration config, OutputStream out);  }