java实现,读取解析csv文件内容

List lines = new ArrayList();
  		BufferedReader br=null;
  		InputStreamReader isr=null;
  		try {
  			File file = new File("F:/DEMOT/20200121.csv");
  			if (file.isFile() && file.exists()) {
  				isr = new InputStreamReader(new FileInputStream(file), "utf-8");
  				br = new BufferedReader(isr);
  				String lineTxt = null;
  				while ((lineTxt = br.readLine()) != null) {
  					lines.add(lineTxt);
  				}
  			} else {
  				WebLogs.getLogger().info("================读取文件不存在!");
  			}
  		} catch (Exception e) {
  			WebLogs.getLogger().info("=================文件读取错误!");
  		}finally{
  			if(br!=null){
  				br.close();
  			}if(isr!=null){
  				isr.close();
  			}
  		}

你可能感兴趣的:(java实现,读取解析csv文件内容)