通过字节流复制一张图片
public class Test5 {
public static void main(String[] args) throws IOException {
//创建字节输入流对象
FileInputStream fis = new FileInputStream("lcl.jpg");
//创建字节输出流对象
FileOutputStream fos= new FileOutputStream("d:\\lcl.jpg");
//一次读写一个字符数组
int len;
byte[] bys = new byte[1024];
while ((len = fis.read(bys)) != -1) {
fos.write(bys, 0, len);
}
//释放资源
fos.close();
fis.close();
}
}