public class FileSystemUtil extends Object
| Modifier and Type | Field and Description |
|---|---|
static org.apache.hadoop.fs.PathFilter |
DUMMY_FILTER
Filter that will accept all files and directories.
|
| Constructor and Description |
|---|
FileSystemUtil() |
| Modifier and Type | Method and Description |
|---|---|
static List<org.apache.hadoop.fs.FileStatus> |
listAll(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean recursive,
org.apache.hadoop.fs.PathFilter... filters)
Returns statuses of all directories and files present in given path applying custom filters if present.
|
static List<org.apache.hadoop.fs.FileStatus> |
listAllSafe(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean recursive,
org.apache.hadoop.fs.PathFilter... filters)
Returns statuses of all directories and files present in given path applying custom filters if present.
|
static List<org.apache.hadoop.fs.FileStatus> |
listDirectories(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean recursive,
org.apache.hadoop.fs.PathFilter... filters)
Returns statuses of all directories present in given path applying custom filters if present.
|
static List<org.apache.hadoop.fs.FileStatus> |
listDirectoriesSafe(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean recursive,
org.apache.hadoop.fs.PathFilter... filters)
Returns statuses of all directories present in given path applying custom filters if present.
|
static List<org.apache.hadoop.fs.FileStatus> |
listFiles(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean recursive,
org.apache.hadoop.fs.PathFilter... filters)
Returns statuses of all files present in given path applying custom filters if present.
|
static List<org.apache.hadoop.fs.FileStatus> |
listFilesSafe(org.apache.hadoop.fs.FileSystem fs,
org.apache.hadoop.fs.Path path,
boolean recursive,
org.apache.hadoop.fs.PathFilter... filters)
Returns statuses of all files present in given path applying custom filters if present.
|
static org.apache.hadoop.fs.PathFilter |
mergeFilters(org.apache.hadoop.fs.PathFilter... filters)
Will merge given array of filters into one.
|
static org.apache.hadoop.fs.PathFilter |
mergeFilters(org.apache.hadoop.fs.PathFilter filter,
org.apache.hadoop.fs.PathFilter[] filters)
Merges given filter with array of filters.
|
public static final org.apache.hadoop.fs.PathFilter DUMMY_FILTER
public static List<org.apache.hadoop.fs.FileStatus> listDirectories(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.PathFilter... filters) throws IOException
fs - current file systempath - path to directoryrecursive - true if nested directories should be includedfilters - list of custom filters (optional)IOExceptionpublic static List<org.apache.hadoop.fs.FileStatus> listDirectoriesSafe(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.PathFilter... filters)
fs - current file systempath - path to directoryrecursive - true if nested directories should be includedfilters - list of custom filters (optional)public static List<org.apache.hadoop.fs.FileStatus> listFiles(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.PathFilter... filters) throws IOException
fs - current file systempath - path to file or directoryrecursive - true if files in nested directories should be includedfilters - list of custom filters (optional)IOExceptionpublic static List<org.apache.hadoop.fs.FileStatus> listFilesSafe(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.PathFilter... filters)
fs - current file systempath - path to file or directoryrecursive - true if files in nested directories should be includedfilters - list of custom filters (optional)public static List<org.apache.hadoop.fs.FileStatus> listAll(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.PathFilter... filters) throws IOException
fs - current file systempath - path to file or directoryrecursive - true if nested directories and their files should be includedfilters - list of custom filters (optional)IOExceptionpublic static List<org.apache.hadoop.fs.FileStatus> listAllSafe(org.apache.hadoop.fs.FileSystem fs, org.apache.hadoop.fs.Path path, boolean recursive, org.apache.hadoop.fs.PathFilter... filters)
fs - current file systempath - path to file or directoryrecursive - true if nested directories and their files should be includedfilters - list of custom filters (optional)public static org.apache.hadoop.fs.PathFilter mergeFilters(org.apache.hadoop.fs.PathFilter filter,
org.apache.hadoop.fs.PathFilter[] filters)
filter - given filterfilters - array of filterspublic static org.apache.hadoop.fs.PathFilter mergeFilters(org.apache.hadoop.fs.PathFilter... filters)
DUMMY_FILTER.filters - array of filtersCopyright © 2022 The Apache Software Foundation. All rights reserved.