Creating a File from byte array

前端 未结 3 1489
你的背包
你的背包 2020-12-19 04:52

So - I\'ve got a third party library that needs a File as input. I\'ve got a byte array.

I don\'t want to write the bytes to disk .. I\'d

3条回答
  •  别那么骄傲
    2020-12-19 05:33

    Sorry, not possible. A File is inherently an on-disk entity, unless you have a RAM disk - but that's not something you can create in Java.

    That's exactly the reason why APIs should not be based on File objects (or be overloaded to accept an InputStream).

提交回复
热议问题