import java.io.FileNotFoundException;
import java.io.IOException;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import com.csvreader.CsvReader;
import com.wer.factories.PrintFactory;
/**
* CSV文件处理API
*
*/
public class CsvParser {
private char Seperator = ','; // CSV格式分隔符
private String CsvPath = ""; // CSV文件路径
private CsvReader reader;
public CsvParser() {
initial();
}
public CsvParser(String path) {
this.CsvPath = path;
initial();
}
public CsvParser(String path, char sepr) {
this.CsvPath = path;
this.Seperator = sepr;
initial();
}
private void initial() {
try {
reader = new CsvReader(CsvPath, Seperator, Charset.forName("GBK"));
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
public boolean ifValid()
{
if(reader==null)
return false;
return true;
}
/**
版权声明:本文为yinxinla原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。