啊哼
public static void addCloumn(List<String> pList, String filePath) throws IOException{ BufferedReader bufReader = new BufferedReader(new FileReader(filePath)); String lineStr = ""; int rowNumber = 0; StringBuffer nContent = new StringBuffer(); while((lineStr = bufReader.readLine()) != null){ String addValue = ""; if(rowNumber < pList.size()){ addValue = pList.get(rowNumber); } if(lineStr.endsWith(",")){ nContent.append(lineStr).append("\""+addValue+"\""); }else{ nContent.append(lineStr).append(",\""+addValue+"\""); } rowNumber++; nContent.append("\r\n"); } bufReader.close(); FileOutputStream fileOs = new FileOutputStream(new File(filePath), false); fileOs.write(nContent.toString().getBytes()); fileOs.close(); }