Code example for StringWriter

Methods: closetoString

     * 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);
            return writer.toString();
        } catch (IOException e) {
            // ignore when writing to string 
            LogFactory.getLog(XmlFile.class).error("Ignoring exception", e);
            return ""; 
Stop searching for code, let great code find you!  Add Codota to your java IDE