This code shows how to use Volley library to download a file directory to SDCard using inputstream. Also, the code shows how to extract the response headers recived in request class to fetch the filename.
You can read more about it in the following blog: www.techstricks.com/download-file-using-android-volley/