类 FileOperation
java.lang.Object
io.github.amsonix.molt.internal.reschiper.operations.FileOperation
Utility class for various file operations.
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明static voidcopyFileUsingStream(File source, @NotNull File dest) Copies a file from a source location to a destination location using streams.static booleanRecursively deletes a directory and its contents.static StringgetFilePrefixByFileName(@NotNull String fileName) Gets the file prefix (name without extension) from a file name.static @NotNull StringgetFileSimpleName(@NotNull com.android.tools.build.bundletool.model.ZipPath zipPath) Gets the simple name of a file from a ZipPath.static longgetFileSizes(@NotNull File f) Gets the size of a file in bytes.static @NotNull StringgetFileSuffix(@NotNull com.android.tools.build.bundletool.model.ZipPath zipPath) Gets the file suffix (extension) from a ZipPath.static StringgetNameFromZipFilePath(@NotNull String zipPath) Gets the name of a file from a Zip file path.static @NotNull StringgetNetFileSizeDescription(long size) Gets a human-readable file size description from a file size in bytes.static @NotNull StringgetParentFromZipFilePath(@NotNull String zipPath) Gets the parent directory path from a Zip file path.static longgetZipPathFileSize(ZipFile zipFile, ZipEntry zipEntry) Gets the size of a file within a ZIP archive.static voiduncompress(Path uncompressedFile, Path targetDir) Uncompressed a ZIP file to a target directory.
-
构造器详细资料
-
FileOperation
public FileOperation()
-
-
方法详细资料
-
deleteDir
Recursively deletes a directory and its contents.- 参数:
file- The directory to delete.- 返回:
- true if the directory was successfully deleted, false otherwise.
-
uncompress
Uncompressed a ZIP file to a target directory.- 参数:
uncompressedFile- The ZIP file to uncompress.targetDir- The target directory to extract the contents.- 抛出:
IOException- If an I/O error occurs during the uncompressed.
-
getNetFileSizeDescription
Gets a human-readable file size description from a file size in bytes.- 参数:
size- The file size in bytes.- 返回:
- A string representing the file size with appropriate units (B, KB, MB, GB).
-
getFileSizes
Gets the size of a file in bytes.- 参数:
f- The file to get the size of.- 返回:
- The file size in bytes.
-
getZipPathFileSize
Gets the size of a file within a ZIP archive.- 参数:
zipFile- The ZIP file.zipEntry- The ZIP entry representing the file.- 返回:
- The size of the file in bytes.
-
copyFileUsingStream
Copies a file from a source location to a destination location using streams.- 参数:
source- The source file to copy.dest- The destination file.- 抛出:
IOException- If an I/O error occurs during the copying process.
-
getFileSimpleName
@NotNull public static @NotNull String getFileSimpleName(@NotNull @NotNull com.android.tools.build.bundletool.model.ZipPath zipPath) Gets the simple name of a file from a ZipPath.- 参数:
zipPath- The ZipPath representing the file.- 返回:
- The simple name of the file.
-
getFileSuffix
@NotNull public static @NotNull String getFileSuffix(@NotNull @NotNull com.android.tools.build.bundletool.model.ZipPath zipPath) Gets the file suffix (extension) from a ZipPath.- 参数:
zipPath- The ZipPath representing the file.- 返回:
- The file suffix (extension).
-
getParentFromZipFilePath
Gets the parent directory path from a Zip file path.- 参数:
zipPath- The Zip file path.- 返回:
- The parent directory path.
-
getNameFromZipFilePath
Gets the name of a file from a Zip file path.- 参数:
zipPath- The Zip file path.- 返回:
- The file name.
-
getFilePrefixByFileName
Gets the file prefix (name without extension) from a file name.- 参数:
fileName- The file name.- 返回:
- The file prefix.
-