FileUtil

open class FileUtil

Provides utility methods to work files and folders.

Types

Link copied to clipboard
open class StrictMode
Provides strict mode equivalents to methods in FileUtil.

Functions

Link copied to clipboard
open fun closeQuietly(closeable: Closeable)
Closes the given Closeable object ignoring any resulting exceptions.
Link copied to clipboard
open fun delete(path: File): Boolean
Deletes a file or folder, even if the folder is not empty.
Link copied to clipboard
open fun exists(path: String): Boolean
Checks if specified path points to a file or directory that exists on the local filesystem.
Link copied to clipboard
open fun getExternalDirectory(context: Context, folderType: String, name: String): File
Gets the path to a directory on the primary shared/external storage device where the application can place persistent files it owns.
Link copied to clipboard
open fun getFileName(url: String): String
Gets the file name from a URL string.
Link copied to clipboard
open fun hasFileScheme(uri: URI): Boolean
Checks if the URI has a file scheme.
Link copied to clipboard
open fun isDirectory(path: String): Boolean
Checks if specified path points to a directory that exists on the local filesystem.
Link copied to clipboard
open fun isFile(path: String): Boolean
Checks if specified path points to a file that exists on the local filesystem.
Link copied to clipboard
open fun isFileValid(path: File): Boolean
Checks if the specified path is valid, meaning it exists or can be created, has read permissions and has write permissions
Link copied to clipboard
Checks if the specified path is a directory that can be read from and written into.
Link copied to clipboard
open fun saveInputStream(target: File, source: InputStream)
Utility method to save the input stream to the file provided.