标签:puts nbsp ids top util read fileinput file buffered
-----------写
FileOutputStream fos = new FileOutputStream(new File("C:\\Users\\fenglei.ma\\Desktop\\新建文件夹\\sid.txt"));
OutputStreamWriter osw = new OutputStreamWriter(fos, "utf-8");
PrintWriter pw = new PrintWriter(osw);
pw.write(sid);
pw.write("\r\n");
-----------读
List<String> sids = new ArrayList<String>();
InputStreamReader isr = new InputStreamReader(new FileInputStream(new File("C:\\Users\\fenglei.ma\\Desktop\\新建文件夹\\sid.txt")), "utf-8");
BufferedReader br = new BufferedReader(isr);
String mes = "";
while((mes = br.readLine()) != null){
if(StringUtils.isNotEmpty(mes))
sids.add(mes);
}
}
br.close();
标签:puts nbsp ids top util read fileinput file buffered
原文地址:http://www.cnblogs.com/xiaolei2017/p/7852682.html