How to store a byte array as an image file on disk?

前端 未结 3 1110
广开言路
广开言路 2021-02-20 09:08

I have a byte array representation of a Image. How to save it on disk as an image file.

I have already done this

OutputStream out = new FileOutputStream(         


        
3条回答
  •  攒了一身酷
    2021-02-20 09:35

    You could use the FileOutputStream class:

    FileOutputStream fos = new FileOutputStream("image.jpg");
    try {
        fos.write(someByteArray);
    }
    finally {
        fos.close();
    }
    

提交回复
热议问题