Convert inputStream to FileInputStream?

I have a problem - I need to read SecretKey from the Android APK (for example, key.keystore), for my application it needs to be read as FileInputStream, but from the assets I get only inputStream. How to convert inputStream to FileInputStream? Or is there any other way how to access the file, for example. resources like fileInputStream?

thanks

+4
source share
3 answers

Why do you need a FileInputStream? In general, you do not need to worry about the basic InputStream implementation that you just read. Perhaps your implementation should be an agnostic of InputStream.

+7
source

I think you mean AssetManager.open () , which returns an InputStream. There is no need to "convert" it to a FileInputStream, just get a link to an InputStream and use it (wrap it in a BufferedInputStream if you want).

+4
source

I do not think this is possible because FileInputStream is just an InputStream for files. It performs the task of getting an InputStream from a specific file for you, after which you work with a regular InputStream.

Android has already done the job for you. So why do you need a FileInputStream?

+2
source

All Articles