Code example for StringWriter

Methods: closetoString

0
     * Use only for preview, use write function to dump it to the file. 
     * 
     */ 
    public String getFileContent(Location location) {
        try { 
            StringWriter writer = new StringWriter();
            write(writer, location);
            writer.close();
            return writer.toString();
        } catch (IOException e) {
            // ignore when writing to string 
            LogFactory.getLog(XmlFile.class).error("Ignoring exception", e);
            return ""; 
        } 
    } 
} 
Experience pair programming with AI  Get Codota for Java