IO操作总结

1,读取文件将文件转换为二进制流

1         InputStream in = new FileInputStream("C:/test.png");
2         byte[] photo = new byte[in.available()];
3         in.read(photo);
4         in.close();
View Code

2,写文件

1         OutputStream out = new FileOutputStream("c:/copy.png");
2         out.write(u.getPhoto());
3         out.close();
View Code

 

posted @ 2016-07-14 11:01  凝荷  阅读(157)  评论(0编辑  收藏  举报