public File getCsvData() {

        List<DataLead> leads = selectAll();
        if(leads == null) {
            this.errorLogFile.log(LoggingProxy.ERROR, "[---]CsvProxy error. Can't get data. ");
            return null;
        }
        File tmp = createCsvFile();
        if(tmp == null) {
            this.errorLogFile.log(LoggingProxy.ERROR,
                    "[---]CsvProxy error. Can't create tmp file. ");
            return null;
        }
        try {
            /**
             * Create an output stream with UTF-8 encoding.
             */
            FileOutputStream fos = new FileOutputStream(tmp);
            OutputStreamWriter osw = new OutputStreamWriter(fos, "UTF-8");

            /**
             * Write file line by line.
             */
            for (DataLead l : leads) {
                for (int i = 0; i < l.size(); ++i) {
                    /**
                     * If the value is null, use 'wu' instead.
                     */
                    String t = l.get(i);
                    if(t == null) {
                        t = "无";
                    }

                    osw.write(t);
                    if (i < l.size() - 1) {
                        osw.write(",");
                    }
                }
                /**
                 * Windows line delimiter.
                 */
                osw.write("\r\n");
            }
            osw.flush();
            osw.close();

            return tmp;

        } catch (FileNotFoundException e) {
            this.errorLogFile.log(LoggingProxy.ERROR, "[---]CsvProxy error. File ont found. "
                    + e.getMessage());
            return null;

        } catch (UnsupportedEncodingException e) {
            this.errorLogFile.log(LoggingProxy.ERROR, "[---]CsvProxy error. Unsupported encoding."
                    + e.getMessage());
            return null;

        } catch (IOException e) {
            this.errorLogFile.log(LoggingProxy.ERROR, "[---]CsvProxy error. IO exception."
                    + e.getMessage());
            return null;

        }

    }