@ThreadSafe public final class UnderFileSystemUtils extends Object
UnderFileSystem
.Modifier and Type | Method and Description |
---|---|
static String |
approximateContentHash(long length,
long modTime)
Returns an approximate content hash, using the length and modification time.
|
static void |
deleteDirIfExists(UnderFileSystem ufs,
String path)
Deletes the directory at the given path if it exists.
|
static void |
deleteFileIfExists(UnderFileSystem ufs,
String path)
Deletes the specified path from the specified under file system if it is a file and exists.
|
static String |
getBucketName(AlluxioURI uri) |
static boolean |
isCephFS(UnderFileSystem ufs) |
static boolean |
isGcs(UnderFileSystem ufs) |
static boolean |
isHdfs(UnderFileSystem ufs) |
static boolean |
isLocal(UnderFileSystem ufs) |
static boolean |
isOss(UnderFileSystem ufs) |
static boolean |
isS3(UnderFileSystem ufs) |
static boolean |
isWeb(UnderFileSystem ufs) |
static void |
mkdirIfNotExists(UnderFileSystem ufs,
String path)
Attempts to create the directory if it does not already exist.
|
static void |
touch(UnderFileSystem ufs,
String path)
Creates an empty file.
|
public static void deleteDirIfExists(UnderFileSystem ufs, String path) throws IOException
ufs
- instance of UnderFileSystem
path
- path to the directoryIOException
public static void mkdirIfNotExists(UnderFileSystem ufs, String path) throws IOException
ufs
- instance of UnderFileSystem
path
- path to the directoryIOException
public static void touch(UnderFileSystem ufs, String path) throws IOException
ufs
- instance of UnderFileSystem
path
- path to the fileIOException
public static void deleteFileIfExists(UnderFileSystem ufs, String path)
ufs
- instance of UnderFileSystem
path
- the path to deletepublic static boolean isGcs(UnderFileSystem ufs)
ufs
- the UnderFileSystem
implementation to checkpublic static boolean isLocal(UnderFileSystem ufs)
ufs
- the UnderFileSystem
implementation to checkpublic static boolean isHdfs(UnderFileSystem ufs)
ufs
- the UnderFileSystem
implementation to checkpublic static boolean isOss(UnderFileSystem ufs)
ufs
- the UnderFileSystem
implementation to checkpublic static boolean isS3(UnderFileSystem ufs)
ufs
- the UnderFileSystem
implementation to checkpublic static boolean isWeb(UnderFileSystem ufs)
ufs
- the UnderFileSystem
implementation to checkpublic static boolean isCephFS(UnderFileSystem ufs)
ufs
- the UnderFileSystem
implementation to checkpublic static String getBucketName(AlluxioURI uri)
uri
- the UFS pathpublic static String approximateContentHash(long length, long modTime)
length
- the content lengthmodTime
- the content last modification timeCopyright © 2023. All Rights Reserved.