`
qxmcool
  • 浏览: 91124 次
  • 性别: Icon_minigender_1
  • 来自: 石家庄
社区版块
存档分类
最新评论

java读取图片文件

    博客分类:
  • java
阅读更多
package random;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;


public class PicIO {

public static void main(String[] args) throws Exception{
InputStream fis = new FileInputStream(new File("c:\\测试\\宝贝.jpg"));
OutputStream fos = new FileOutputStream(new File("c:\\测试\\temp.jpg"));
int a = 0;
byte[] temp = new byte[100];
while((a = fis.read(temp))>0){
int b = 0;
b+=a;
fos.write(temp,0,b);
}
fos.flush();
fis.close();
fos.close();
}
}
分享到:
评论
1 楼 416935357 2011-08-31  
,谢谢,可是我的那个是用字节流导入数据库不知道为什么一直出现异常

相关推荐

Global site tag (gtag.js) - Google Analytics