0
点赞
收藏
分享

微信扫一扫

4-30流--案例

時小白 2022-04-30 阅读 58

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();
        
    }
}
举报

相关推荐

0 条评论