Converting inputStream to FileInputStream?

Waypoint picture Waypoint · Apr 24, 2011 · Viewed 13.3k times · Source

I am in a problem - i need to read SecretKey from Android APK (e.g. key.keystore), for my app it has to be read as a FileInputStream, but from assets I am getting only inputStream. How to convert inputStream to FileInputStream? Or is there any other way, how to acces file from e.g. resources as a fileInputStream?

Thanks

Answer

dmon picture dmon · Apr 24, 2011

Why do you need a FileInputStream specifically? In general, you don't have to care about the underlying implementation of the InputStream, you just read from it. Maybe your implementation should be InputStream agnostic.