用IO流复制一张图片

// 复制图片 将图片1 复制到2
BufferedInputStream bis = null;
BufferedOutputStream bos = null;

bis = new BufferedInputStream(new FileInputStream("1.png"));
bos = new BufferedOutputStream(new FileOutputStream("2.png"));

byte[] bs = new byte[1024*1024];      //这里1024 是1kb   
int b = -1;

while((b=bis.read(bs))!= -1) {
bos.write(bs,0,b);               
}

posted @ 2020-06-04 14:41  wlp贼丑  阅读(182)  评论(0编辑  收藏  举报