Code example for StringWriter

Methods: closetoString

0
     */ 
    private String convertJson(String entityText) throws IOException {
        HierarchicalStreamDriver driver = new JettisonMappedXmlDriver();
        StringReader reader = new StringReader(entityText);
        HierarchicalStreamReader hsr = driver.createReader(reader);
        StringWriter writer = new StringWriter();
        new HierarchicalStreamCopier().copy(hsr, new PrettyPrintWriter(writer));
        writer.close();
        return writer.toString();
    } 
 
    public void setXmlConfig(XMLConfiguration xmlConfig) {
        this.xmlConfig = xmlConfig;
    } 
 
    public void setTileBreeder(TileBreeder seeder) {
        this.seeder = seeder;
    } 
} 
Experience pair programming with AI  Get Codota for Java