Convert UsbFile to Java type File

2020-02-11 11:49发布

问题:

I am using libaums and I read file from USB. All files as a UsbFile type. I want send my file to FTP. When I send FTP need use FileInputStream ant thos have parameter File. How can I convert?

回答1:

I think I answered this now a couple of times, at different places. There is simply no way to "convert" a UsbFile into a java.io.File. They are just completely different things. What you want to do is to use the UsbFileInputStream. Your FTP library (whichever it is..) should be able to handle a generic InputStream instead of only FileInputStreams.