读书人

//资料 流操作图片

发布时间: 2012-10-18 13:46:55 作者: rapoo

//文件 流操作图片

?

//文件操作

String path = "g:/iphone4.jpg";

File file = new File(path);

?

FileInputStream fis = new FileInputStream(file);

byte[] b = new byte[fis.available()];

StringBuilder str = new StringBuilder();//不建议用String

?fis.read(b);

?

?

?

//把字节数组的图片写到另一个地方

?

? ?File apple= new File("D:/apple.jpg");

? ?FileOutputStream fos = new FileOutputStream(apple);

? ?fos.write(b);

? ?fos.flush();

?

//

读书人网 >编程

热点推荐