當前位置: 首頁>>代碼示例>>Java>>正文


Java CSVWriter.DEFAULT_QUOTE_CHARACTER屬性代碼示例

本文整理匯總了Java中au.com.bytecode.opencsv.CSVWriter.DEFAULT_QUOTE_CHARACTER屬性的典型用法代碼示例。如果您正苦於以下問題:Java CSVWriter.DEFAULT_QUOTE_CHARACTER屬性的具體用法?Java CSVWriter.DEFAULT_QUOTE_CHARACTER怎麽用?Java CSVWriter.DEFAULT_QUOTE_CHARACTER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在au.com.bytecode.opencsv.CSVWriter的用法示例。


在下文中一共展示了CSVWriter.DEFAULT_QUOTE_CHARACTER屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: HITDataCSVReader

public HITDataCSVReader(String fileName, char separator) throws IOException {
    super();
    InputStreamReader input = new InputStreamReader(new FileInputStream(fileName), "UTF-8");
    CSVReader csvReader = new CSVReader(input, separator, CSVWriter.DEFAULT_QUOTE_CHARACTER);
    String[] row = null;
    
    try {
      // read all lines but skip header rows that got appended repetitively
      while ((row = csvReader.readNext()) != null) {
        if (fieldNames == null) {
          fieldNames = row;
          rows.add(fieldNames); // header is at index 0
        }
        else if (!Arrays.equals(fieldNames, row)) {
          rows.add(row);
        }
      }
    }
    finally {
      csvReader.close();
    }
}
 
開發者ID:dbarowy,項目名稱:java-aws-mturk,代碼行數:22,代碼來源:HITDataCSVReader.java

示例2: getWriter

protected synchronized CSVWriter getWriter() throws IOException {
    if (this.csvWriter == null) {
        FileOutputStream fos = new FileOutputStream(this.fileName, appendToFile); // always append, 
        OutputStreamWriter writer = new OutputStreamWriter(fos, "UTF-8");
        this.csvWriter = new CSVWriter( writer,
            separator,
            useQuotes ? CSVWriter.DEFAULT_QUOTE_CHARACTER : CSVWriter.NO_QUOTE_CHARACTER,
            System.getProperty("line.separator"));
    }
    return this.csvWriter;
}
 
開發者ID:dbarowy,項目名稱:java-aws-mturk,代碼行數:11,代碼來源:HITDataCSVWriter.java


注:本文中的au.com.bytecode.opencsv.CSVWriter.DEFAULT_QUOTE_CHARACTER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。