https://meilishiyan-song.taobao.com/

读取数据到txt中

@Test
public void testReadExcel() throws IOException {
StringBuffer s = new StringBuffer();
s.append("afda dfd");
s.append("\t");
s.append("df/d");
s.append("\t");
s.append("\n");
s.append("afda dfd");
s.append("\t");
s.append("df/d");
s.append("\t");
s.append("\n");
s.append("afda dfd");
s.append("\t");
s.append("df/d");
s.append("\t");
s.append("\n");
File f = new File("d:/ddd/ddd.txt");
if (!f.getParentFile().exists()) {
f.getParentFile().mkdirs();
f.createNewFile();
}
OutputStream out = null;
try {
out = new FileOutputStream(f);
out.write(s.toString().getBytes());
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

}

posted @ 2017-04-03 14:30  望梦圆  阅读(167)  评论(0编辑  收藏  举报
https://meilishiyan-song.taobao.com/