Code example for BufferedWriter

Methods: close

0
  public boolean saveXML(final MasterReport report, final String fileName)
  { 
    Writer out = null;
    try 
    { 
      out = new BufferedWriter(new FileWriter(new File(fileName)));
 
      final XMLProcessor xprc = new XMLProcessor(report);
      xprc.setWriter(out);
      xprc.processReport();
      return true; 
    } 
    catch (Exception e)
    { 
      System.err.println("Writing PDF failed.");
      System.err.println(e.toString());
      return false; 
    } 
    finally 
    { 
      try 
      { 
        if (out != null)
        { 
          out.close();
        } 
      } 
      catch (Exception e)
      { 
        System.err.println("Saving XML failed.");