1 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 23 public class CSVFileTools extends FileTools 24 { 25 26 private static Logger logger = Logger.getLogger(CSVFileTools.class); 27 28 private static ResourceBundle resources = ResourceBundle.getBundle("org.ejtools.util.Resources"); 29 30 public final static SimpleFileFilter CSV_FILE_FILTER = new FileTools.SimpleFileFilter(".csv", resources.getString("csv.file.dialog.extension.description")); 31 32 33 34 protected CSVFileTools() { } 35 36 37 43 public static void exportAsCVS(StringBuffer content, File output) 44 { 45 try 46 { 47 FileWriter writer = new FileWriter (output); 48 writer.write(content.toString()); 49 writer.flush(); 50 writer.close(); 51 } 52 catch (IOException ioe) 53 { 54 logger.error("Can't export content as CSV", ioe); 55 } 56 } 57 } 58 | Popular Tags |