Construct a java.io.File that reads from a byte array

后端 未结 4 567
失恋的感觉
失恋的感觉 2021-01-20 05:49

I\'m using an API that requires a java.io.File as input, but I\'d like to just send the API a byte array. Is there a way to create a File object that will read from my byte

4条回答
  •  面向向阳花
    2021-01-20 06:22

    You could open a temporary file: open temp file in java

    Then if take your byte[] and write it all to the temporary file through some OutputStream/Writer you should have what you need. Then you can pass the file without creating it on disk.

提交回复
热议问题