Package-level declarations

Properties

Link copied to clipboard
const val BUFFER_LEN: Int = 8192
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Determines if current DocumentFile is an Audio Courtesy: Code of Amaze file manager

Link copied to clipboard

Determines if current DocumentFile is an image Courtesy: Code of Amaze file manager

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Determines if current DocumentFile is a Video Courtesy: Code of Amaze file manager

Link copied to clipboard
const val KB: Int = 1024
Link copied to clipboard
const val MB: Int

Functions

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun File.clearFileAndWriteText(text: String, charset: Charset = Charsets.UTF_8)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun File.copy(dest: File)

Copy File/Dir to new Destination

Link copied to clipboard

Copies data from input stream

Link copied to clipboard
Link copied to clipboard
fun createZip(files: List<String>, file: File, bufferSize: Int = 2048): String?

Create zip of files

Link copied to clipboard
fun createZipFile(srcFile: File, zipFile: File): Boolean
fun createZipFile(srcFilePath: String, zipFilePath: String): Boolean
fun createZipFile(srcFile: File?, zipFile: File?, comment: String?): Boolean
fun createZipFile(srcFilePath: String, zipFilePath: String, comment: String): Boolean

Zip the file.

Link copied to clipboard

Deletes all files

Link copied to clipboard
Link copied to clipboard
fun deleteDir(dir: File?): Boolean
Link copied to clipboard

Deletes given directory and returns result

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun downloadFile(urlPath: String, localPath: String, callback: (Uri?) -> Unit = {}): Uri?
Link copied to clipboard
fun downloadFileWithProgress(urlPath: String, localPath: String, connectionCallBack: (responseCode: Int) -> Unit = {}, onError: (Exception) -> Unit = {}, progress: (Int) -> Unit = {}, callback: (Uri?) -> Unit = {})
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun File.fileIsMimeType(mimeType: String?, mimeTypeMap: MimeTypeMap): Boolean
Link copied to clipboard

Attempts to find and return the size of the file at the given uri.

Link copied to clipboard

Checks and returns if there's a valid directory with given path

Link copied to clipboard
fun getComments(zipFile: File?): List<String>?
fun getComments(zipFilePath: String): List<String>?

Return the files' comment in ZIP file.

Link copied to clipboard
fun Context.getDataColumn(uri: Uri, selection: String?, selectionArgs: Array<String>?): String?

Get the value of the data column for this Uri. This is useful for MediaStore Uris, and other file-based ContentProviders.

Link copied to clipboard

Get the size of the directory in bytes format

Link copied to clipboard

Gets the file count of given directory

Link copied to clipboard

Gets all files in given directory

Link copied to clipboard
fun getFilesPath(zipFile: File?): List<String>?
fun getFilesPath(zipFilePath: String): List<String>?

Return the files' path in ZIP file.

Link copied to clipboard

Calculates the folder size

Link copied to clipboard
Link copied to clipboard

Get myme type of file

Link copied to clipboard
fun Uri.getRealPath(context: Context): String?

Gets the actual path of the Uri.

Link copied to clipboard
Link copied to clipboard
fun Context.getUriFromFile(file: File, authority: String): Uri
fun File.getUriFromFile(context: Context, authority: String): Uri

Gets an uri of file

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

returns true if File is an Image

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The method is use to prevent a problem, when several threads can try to .mkdirsIfNotExist for the same Path simultaneously.

Link copied to clipboard
fun File.move(dest: File)

Move File/Dir to new Destination

Link copied to clipboard
Link copied to clipboard

Open File in InputStream

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
fun Uri?.readBytes(context: Context): ByteArray?
Link copied to clipboard

Read File data as String and Returns the Result

Link copied to clipboard

Recursively listing File files returning the list of all files

fun recursiveDirectoryListing(files: Array<File>?, callbackArray: ArrayList<File>)

Recursively listing File files

fun recursiveDirectoryListing(files: Array<File>?, fileCallback: (file: File) -> Unit = {})

Recursive listing File files

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

Tries to return the mime type from the file path

Link copied to clipboard
fun saveFile(fullPath: String, content: String): File
Link copied to clipboard
inline fun File.saveFile(runBlockIfOk: () -> Unit, runBlockIfFail: () -> Unit, useMkdirsIfNotExistSynchronized: Boolean)
Link copied to clipboard

Convert File to ByteArray

Opens and reads the entirety of the Uri into a ByteArray.

Link copied to clipboard
Link copied to clipboard
fun File.toUri(): Uri
Link copied to clipboard
fun unzipFile(zipFile: File, destDir: File): List<File>?
fun unzipFile(zipFilePath: String, destDirPath: String): List<File>?

Unzip the file.

Link copied to clipboard
fun unzipFileByKeyword(zipFile: File?, destDir: File?, keyword: String?): List<File>?
fun unzipFileByKeyword(zipFilePath: String, destDirPath: String, keyword: String?): List<File>?

Unzip the file by keyword.

Link copied to clipboard
fun zipFiles(srcFiles: Collection<File>, zipFile: File): Boolean
fun zipFiles(srcFiles: Collection<String>, zipFilePath: String): Boolean
fun zipFiles(srcFiles: Collection<File>?, zipFile: File?, comment: String?): Boolean
fun zipFiles(srcFilePaths: Collection<String>?, zipFilePath: String?, comment: String?): Boolean

Zip the files.