public final class FileUtils extends Object
Modifier and Type | Method | Description |
---|---|---|
static void |
defineFilePosixAttributeView(Path path,
Set<PosixFilePermission> filePermissions,
String fileOwner,
String fileGroup) |
Define file posix attribute view on a path/file.
|
static File |
fileFromUri(URI uri) |
Tries to convert the specified URI to a file object.
|
static String |
getFileExtension(File file) |
|
static boolean |
isFile(URL url) |
|
static boolean |
isFilePosixAttributeViewSupported() |
Check if posix file attribute view is supported on the default FileSystem.
|
static void |
makeParentDirs(File file) |
Creates the parent directories for the given File.
|
static void |
mkdir(File dir,
boolean createDirectoryIfNotExisting) |
Asserts that the given directory exists and creates it if necessary.
|
public static File fileFromUri(URI uri)
uri
- the URIpublic static boolean isFile(URL url)
public static void mkdir(File dir, boolean createDirectoryIfNotExisting) throws IOException
dir
- the directory that shall existcreateDirectoryIfNotExisting
- specifies if the directory shall be created if it does not exist.IOException
- thrown if the directory could not be created.public static void makeParentDirs(File file) throws IOException
file
- IOException
public static void defineFilePosixAttributeView(Path path, Set<PosixFilePermission> filePermissions, String fileOwner, String fileGroup) throws IOException
path
- Target pathfilePermissions
- Permissions to applyfileOwner
- File ownerfileGroup
- File groupIOException
- If IO error during definition of file attribute viewpublic static boolean isFilePosixAttributeViewSupported()
Copyright © 1999-2018. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.