public class FileUtils extends Object
| Constructor and Description |
|---|
FileUtils() |
| Modifier and Type | Method and Description |
|---|---|
static Path |
assetFilePath(@NonNull Path assetDir,
@NonNull Path assetFile)
Allows building path to the asset file.
|
static boolean |
fileContentsEquals(@NonNull Path assetFile,
@NonNull Path otherPath)
Allows checking if content of asset file is equal to the content of the specified file.
|
static Stream<Path> |
listFiles(File folder,
boolean recursive)
Lists files under given folder.
|
static Optional<Path> |
resolveAssetPath(@NonNull Path dir,
@NonNull Path file,
@NonNull AssetOverwriteStrategy overwriteStrategy)
Allows resolving of the path to the asset file based on provided parameters.
|
public static Stream<Path> listFiles(File folder, boolean recursive) throws IOException
folder - the folder to list files in.recursive - if true then subfolder files will be included recursively.IOException - if an I/O exception occurs.public static Optional<Path> resolveAssetPath(@NonNull @NonNull Path dir, @NonNull @NonNull Path file, @NonNull @NonNull AssetOverwriteStrategy overwriteStrategy) throws FileAlreadyExistsException, IOException
dir - the path to the parent directory of the asset file.file - the relative path to the asset file within dir.overwriteStrategy - the overwrite strategy to be applied in case file already exists.IOException - if an I/O exception occurred.FileAlreadyExistsException - if overwriteStrategy is to FAIL when file already exists.public static boolean fileContentsEquals(@NonNull
@NonNull Path assetFile,
@NonNull
@NonNull Path otherPath)
throws IOException
assetFile - the relative path to the asset fileotherPath - the path to the other filetrue if contents of both files are equal.IOException - thrown if any I/O exception occured during the operation.public static Path assetFilePath(@NonNull @NonNull Path assetDir, @NonNull @NonNull Path assetFile)
assetDir - the parent directory of the asset fileassetFile - the relative path to the asset filePath to the asset file.Copyright © 2022. All rights reserved.