public final class FileUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static String |
checksum(Path file,
String algorithm)
Computes the checksum of the file using the provided algorithm.
|
static void |
copy(Path src,
Path dest,
BiPredicate<? super Path,? super BasicFileAttributes> filter,
CopyOption... options)
Copies a path to a target path.
|
static void |
copy(Path src,
Path dest,
CopyOption... options)
Copies a path to a target path.
|
static boolean |
delete(Path path)
Deletes the supplied
Path. |
public static boolean delete(Path path) throws IOException
Path. For directories, recursively delete any nested directories or files as well.path - the path to deletetrue if the path existed and was deleted, or false it did not existIOException - in the case of I/O errorspublic static void copy(Path src, Path dest, CopyOption... options) throws IOException
src - the source pathdest - the destination pathoptions - specifying how the copy should be done the path to the target fileIOException - in the case of I/O errorspublic static void copy(Path src, Path dest, BiPredicate<? super Path,? super BasicFileAttributes> filter, CopyOption... options) throws IOException
src - the source pathdest - the destination pathoptions - specifying how the copy should be done the path to the target filefilter - the function used to decide whether a path should be copied or notIOException - in the case of I/O errorspublic static String checksum(Path file, String algorithm) throws NoSuchAlgorithmException, IOException
file - the file to readalgorithm - the name of the algorithm.NoSuchAlgorithmException - if no Provider supports a MessageDigestSpi implementation for the specified
algorithm.IOException - in the case of I/O errorsCopyright © 2023. All rights reserved.