Created
May 3, 2020 20:10
-
-
Save siifii/3831b9ed6aa62f4b253ff57a82c35b5b to your computer and use it in GitHub Desktop.
copy input stream to file extension
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.os.Environment | |
import java.io.File | |
import java.io.InputStream | |
fun File.copyInputStreamToFile(inputStream: InputStream) { | |
this.outputStream().use { fileOut -> | |
inputStream.copyTo(fileOut) | |
} | |
} | |
fun isExternalStorageWritable(): Boolean { | |
return Environment.getExternalStorageState() == Environment.MEDIA_MOUNTED | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment