1.文件复制:
注意fis fos的地址栏
package 流;
import java.io.FileInputStream;
import java.io.FileOutputStream;
public class Demo01 {
public static void main(String[] args) throws Exception {
FileInputStream fis = new FileInputStream("D:\\hello\\1.jpg");
FileOutputStream fos = new FileOutputStream("D:\\1.bmp");
byte[] bytes = new byte[1024];
int len=0;
while((len=fis.read(bytes))!=-1){
fos.write(bytes,0,len);
}
fos.close();
fis.close();
}
}