merge the formfield patch from ooo-build
[ooovba.git] / qadevOOo / runner / convwatch / LISTOutputter.java
blob739955ba9e1987a422c4cdededbfa1491af3c4c9
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: LISTOutputter.java,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package convwatch;
33 import java.io.File;
34 import java.io.FileWriter;
36 public class LISTOutputter
38 FileWriter m_aOut;
39 String m_sFilename;
41 /**
42 * ls is the current line separator (carridge return)
44 String ls;
46 public static LISTOutputter create( String _sOutputPath, String _sFilename)
48 FileHelper.makeDirectories("", _sOutputPath);
49 LISTOutputter a = new LISTOutputter();
50 String fs = System.getProperty("file.separator");
51 String sFilename = _sOutputPath + fs + _sFilename;
53 try
55 File outputFile = new File(sFilename);
56 a.m_aOut = new FileWriter(outputFile.toString());
57 a.ls = System.getProperty("line.separator");
59 catch (java.io.IOException e)
61 e.printStackTrace();
62 GlobalLogWriter.get().println("ERROR: Can't create LIST Outputter");
63 return null;
65 a.m_sFilename = sFilename;
67 return a;
69 public String getFilename() {return m_sFilename;}
71 public void createHeader()
73 try
75 m_aOut.write("# This file is automatically created by a convwatch run" + ls);
76 m_aOut.write("# " + ls);
78 catch (java.io.IOException e)
83 public void writeValue(String _sValue)
85 try
87 m_aOut.write(_sValue + ls);
88 m_aOut.flush();
90 catch (java.io.IOException e)
95 public void close()
97 try
99 m_aOut.flush();
100 m_aOut.close();
102 catch (java.io.IOException e)