Code example for StringWriter

Methods: close, toString

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 ""; 
        } 
    } 
}