View Javadoc
1 /***
2 * FileHandler.java
3 *
4 * Project: Dependency Tool
5 *
6 * WHEN WHO WHAT
7 * 06.06.2003 pko initial public release
8 * 31.10.2002 pko creation
9 *
10 * Copyright 2003 ELCA Informatique SA
11 * Av. de la Harpe 22-24, 1000 Lausanne 13, Switzerland
12 * www.elca.ch
13 *
14 * This library is free software; you can redistribute it and/or
15 * modify it under the terms of the GNU Lesser General Public License
16 * as published by the Free Software Foundation; either version 2.1 of
17 * the License, or (at your option) any later version.
18 *
19 * This library is distributed in the hope that it will be useful, but
20 * WITHOUT ANY WARRANTY; without even the implied warranty of
21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
22 * Lesser General Public License for more details.
23 *
24 * You should have received a copy of the GNU Lesser General Public
25 * License along with this library; if not, write to the Free Software
26 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
27 * USA
28 */
29
30 package ch.elca.dependency.report;
31
32 import java.io.File;
33 import java.io.FileWriter;
34 import java.io.IOException;
35
36 import ch.elca.dependency.util.IOManager;
37
38 /***
39 * <code>FileHandler</code> used to output a formatted Report to a
40 * file.
41 *
42 * @author Pawel Kowalski
43 * @version 1.0-beta
44 */
45 class FileHandler extends ReportHandler {
46
47 //****************************************************************************************/
48 // output method
49 //****************************************************************************************/
50
51 /***
52 * Output a formatted Report to a file.
53 *
54 * @param report a <code>String</code> value
55 */
56 void output(String report) throws IOException, SecurityException {
57
58 // the OutputManager takes care of creating files, directories
59 // and of resolving conflicts. The returned file will be writable
60 //
61 File reportFile = IOManager.getNewReportFile(getFileName());
62 FileWriter reportWriter = new FileWriter(reportFile);
63
64 reportWriter.write(report);
65 reportWriter.flush();
66 reportWriter.close();
67
68 LOG.info(STRING_MANAGER.getString("report.written") + ": " + reportFile.getPath());
69 }
70 }
This page was automatically generated by Maven