Java 输入输出图片文件的简单方式

import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;

public class FileR_W {
    public static void main(String[] args) throws IOException {
        //创建输入流输出流
        FileInputStream fis = new FileInputStream("70.jpg");
        FileOutputStream fos = new FileOutputStream("test_jpg.jpg",true);
        int len;
        byte[] b = new byte[1024];
        while ((len=fis.read(b))!=-1){
           fos.write(b,0,len);

        }
        fos.close();
        fis.close();
    }
}

猜你喜欢

转载自www.cnblogs.com/theworld/p/11641955.html