Java – convert InputStream to FileInputStream

I have read this article how to convert InputStream to FileInputStream However, if you are using a resource in a jar file, the answer is invalid Is there another way?

I need to do this to get filechannel object from the call class. Getresourceasstream (resource name);

Solution

Without basically writing to the file, you can't There cannot be FileInputStream or filechannel unless there are files If possible, make sure your code is independent of the input source – design it according to InputStream and bytechannel (or whatever type of channel is most appropriate)

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>