Java复制图片

2021/11/1 22:39:38

本文主要是介绍Java复制图片,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

public class Demo04 {
    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("C:\\Users\\雪芹\\Pictures\\Screenshots\\屏幕截图(1).png");
        FileOutputStream fileOutputStream = new FileOutputStream("屏幕截图(1).png");
        byte[]bytes=new byte[1024];
        int by;
        while ((by=fileInputStream.read(bytes))!=-1){
            fileOutputStream.write(bytes,0,by);
        }
        fileOutputStream.close();
        fileInputStream.close();
    }

}


这篇关于Java复制图片的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程