记录不是在java中使用csvwriter逐行写的

时间:2015-11-11 08:00:43

标签: java

我正在使用CSVWriter,其中所有记录都写在一行文本文件中。请帮我纠正我的代码中的错误。

public void parseWritefile()
        {
            try{    

                File file = new File("config.properties");
                FileInputStream fileinput = new FileInputStream(file);
                Properties prop = new Properties();
                prop.load(fileinput);       
                newfile = prop.getProperty("newfile");          
                delimit = prop.getProperty("delimiter");
                delimiter = delimit.charAt(0);          
                fileinput.close();

                Compare Writefile = new Compare();
                List<String[]> fnllist = Writefile.comparecollec();                                 
                CSVWriter writer=new CSVWriter(new FileWriter(newfile),delimiter,'"',"\n");
                log.debug("Records are written");
                writer.writeAll(fnllist);               
                writer.close();
            }
            catch (FileNotFoundException e)
                 {
                    log.error("File not found");
                } 
            catch (IOException e)
                 {
                    log.error("IO exception");  
                }
        }

谢谢,

0 个答案:

没有答案