|
|||||||||||||||||||
| Source file | Conditionals | Statements | Methods | TOTAL | |||||||||||||||
| CSVFileTools.java | - | 0% | 0% | 0% |
|
||||||||||||||
| 1 |
/*
|
|
| 2 |
* EJTools, the Enterprise Java Tools
|
|
| 3 |
*
|
|
| 4 |
* Distributable under LGPL license.
|
|
| 5 |
* See terms of license at www.gnu.org.
|
|
| 6 |
*/
|
|
| 7 |
package org.ejtools.util.export;
|
|
| 8 |
|
|
| 9 |
import java.io.File;
|
|
| 10 |
import java.io.FileWriter;
|
|
| 11 |
import java.io.IOException;
|
|
| 12 |
import java.util.ResourceBundle;
|
|
| 13 |
|
|
| 14 |
import org.apache.log4j.Logger;
|
|
| 15 |
import org.ejtools.util.FileTools;
|
|
| 16 |
|
|
| 17 |
/**
|
|
| 18 |
* Description of the Class
|
|
| 19 |
*
|
|
| 20 |
* @author Laurent Etiemble
|
|
| 21 |
* @version $Revision: 1.2 $
|
|
| 22 |
*/
|
|
| 23 |
public class CSVFileTools extends FileTools |
|
| 24 |
{
|
|
| 25 |
/** Description of the Field */
|
|
| 26 |
private static Logger logger = Logger.getLogger(CSVFileTools.class); |
|
| 27 |
/** Description of the Field */
|
|
| 28 |
private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.util.Resources"); |
|
| 29 |
/** Description of the Field */
|
|
| 30 |
public final static SimpleFileFilter CSV_FILE_FILTER = new FileTools.SimpleFileFilter(".csv", resources.getString("csv.file.dialog.extension.description")); |
|
| 31 |
|
|
| 32 |
|
|
| 33 |
/** Constructor for the FileUtil object */
|
|
| 34 | 0 |
protected CSVFileTools() { }
|
| 35 |
|
|
| 36 |
|
|
| 37 |
/**
|
|
| 38 |
* Description of the Method
|
|
| 39 |
*
|
|
| 40 |
* @param output Description of the Parameter
|
|
| 41 |
* @param content Description of the Parameter
|
|
| 42 |
*/
|
|
| 43 | 0 |
public static void exportAsCVS(StringBuffer content, File output) |
| 44 |
{
|
|
| 45 | 0 |
try
|
| 46 |
{
|
|
| 47 | 0 |
FileWriter writer = new FileWriter(output);
|
| 48 | 0 |
writer.write(content.toString()); |
| 49 | 0 |
writer.flush(); |
| 50 | 0 |
writer.close(); |
| 51 |
} |
|
| 52 |
catch (IOException ioe)
|
|
| 53 |
{
|
|
| 54 | 0 |
logger.error("Can't export content as CSV", ioe);
|
| 55 |
} |
|
| 56 |
} |
|
| 57 |
} |
|
| 58 |
|
|
||||||||||