diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt | 18 |
1 files changed, 0 insertions, 18 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt index 25e0519..b03707d 100644 --- a/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/FileUtils.kt @@ -11,23 +11,5 @@ import java.util.* /** * Created by Allan Wang on 2017-08-04. */ -@Throws(IOException::class) -fun createMediaFile(prefix: String, extension: String): File { - val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) - val imageFileName = "${prefix}_${timeStamp}_" - val storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES) - val frostDir = File(storageDir, prefix) - if (!frostDir.exists()) frostDir.mkdirs() - return File.createTempFile(imageFileName, extension, frostDir) -} - -@Throws(IOException::class) -fun Context.createPrivateMediaFile(prefix: String, extension: String): File { - val timeStamp = SimpleDateFormat("yyyyMMdd_HHmmss", Locale.getDefault()).format(Date()) - val imageFileName = "${prefix}_${timeStamp}_" - val storageDir = getExternalFilesDir(Environment.DIRECTORY_PICTURES) - return File.createTempFile(imageFileName, extension, storageDir) -} - fun File.copyFromInputStream(inputStream: InputStream) = inputStream.use { input -> outputStream().use { output -> input.copyTo(output) } }
\ No newline at end of file |