public class CsvHelper<T> extends TableAbstract
| Constructor and Description |
|---|
CsvHelper() |
| Modifier and Type | Method and Description |
|---|---|
File |
generate(String[] headers,
Collection<T> data,
String filePath)
生成CSV (默认UTF-8)
|
File |
generate(String[] headers,
Collection<T> data,
String filePath,
String encoding)
生成CSV
|
List<T> |
parse(String csvPath,
boolean skipFirstRow,
Class<T> clazz)
解析CSV (默认UTF-8编码)
|
List<T> |
parse(String csvPath,
boolean skipFirstRow,
Class<T> clazz,
String encoding)
解析CSV
|
List<T> |
parse(String csvPath,
int skipRowNo,
Class<T> clazz,
String encoding)
解析CSV
|
public File generate(String[] headers, Collection<T> data, String filePath) throws CsvException
headers - 抬头 (要与数据中的属性顺序和数量对应)data - 数据filePath - 导出的文件路径CsvExceptionpublic File generate(String[] headers, Collection<T> data, String filePath, String encoding) throws CsvException
headers - 抬头 (要与数据中的属性顺序和数量对应)data - 数据filePath - 导出的文件路径encoding - 编码格式CsvExceptionpublic List<T> parse(String csvPath, boolean skipFirstRow, Class<T> clazz) throws CsvException
csvPath - csv绝对路径skipFirstRow - 是否跳过首行clazz - 类CsvExceptionpublic List<T> parse(String csvPath, boolean skipFirstRow, Class<T> clazz, String encoding) throws CsvException
csvPath - csv绝对路径skipFirstRow - 是否跳过首行clazz - 类encoding - 编码CsvExceptionpublic List<T> parse(String csvPath, int skipRowNo, Class<T> clazz, String encoding) throws CsvException
csvPath - csv绝对路径skipRowNo - 跳过前n行clazz - 类CsvExceptionCopyright © 2020. All rights reserved.