本文整理匯總了Java中au.com.bytecode.opencsv.CSVWriter.DEFAULT_SEPARATOR屬性的典型用法代碼示例。如果您正苦於以下問題:Java CSVWriter.DEFAULT_SEPARATOR屬性的具體用法?Java CSVWriter.DEFAULT_SEPARATOR怎麽用?Java CSVWriter.DEFAULT_SEPARATOR使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類au.com.bytecode.opencsv.CSVWriter
的用法示例。
在下文中一共展示了CSVWriter.DEFAULT_SEPARATOR屬性的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: saveCategoriesToFile
/**
* Writes all category entries to the specified csv file.
*
* @param filePath
*/
private void saveCategoriesToFile(String filePath) {
try
{
CSVWriter writer = new CSVWriter(new FileWriter(filePath), CSVWriter.DEFAULT_SEPARATOR, CSVWriter.NO_QUOTE_CHARACTER, "\r\n");
ArrayList<FHCategoryEntry> categoryEntries = getAllCategoryEntries();
String[] headerLine = new String[FHCategoryReader.NUM_COLUMNS_IN_FILE];
headerLine[FHCategoryReader.INDEX_OF_HEADER] = FHCategoryReader.FHAES_CATEGORY_FILE_HEADER;
headerLine[FHCategoryReader.INDEX_OF_VERSION] = FHCategoryReader.FHAES_CATEGORY_FILE_VERSION;
headerLine[FHCategoryReader.INDEX_OF_FILENAME] = workingFile.getFileNameWithoutExtension();
writer.writeNext(headerLine);
for (int i = 0; i < categoryEntries.size(); i++)
{
String[] nextLine = new String[FHCategoryReader.NUM_COLUMNS_IN_FILE];
nextLine[FHCategoryReader.INDEX_OF_SERIES_TITLE] = categoryEntries.get(i).getSeriesTitle();
nextLine[FHCategoryReader.INDEX_OF_CATEGORY] = categoryEntries.get(i).getCategory();
nextLine[FHCategoryReader.INDEX_OF_CONTENT] = categoryEntries.get(i).getContent();
writer.writeNext(nextLine);
}
writer.close();
MainWindow.getInstance().getFeedbackMessagePanel().updateFeedbackMessage(FeedbackMessageType.INFO,
FeedbackDisplayProtocol.AUTO_HIDE, FeedbackDictionary.CATEGORY_FILE_SAVED_MESSAGE.toString());
}
catch (IOException ex)
{
ex.printStackTrace();
}
}