@Test(expected = Exception.class) public void listDirsShouldThrowOnError() throws IOException { HdfsUtils.listDirs(new Configuration(), null); }
public static List<String> listDirs(Configuration hadoopConf, String pathname) throws IOException { return Arrays .stream(FileSystem.get(hadoopConf).listStatus(new Path(pathname))) .filter(FileStatus::isDirectory) .map(x -> x.getPath().toString()) .collect(Collectors.toList()); }
HdfsUtils { public static List<String> listDirs(Configuration hadoopConf, String pathname) throws IOException { return Arrays .stream(FileSystem.get(hadoopConf).listStatus(new Path(pathname))) .filter(FileStatus::isDirectory) .map(x -> x.getPath().toString()) .collect(Collectors.toList()); } }
HdfsUtils { public static List<String> listDirs(Configuration hadoopConf, String pathname) throws IOException { return Arrays .stream(FileSystem.get(hadoopConf).listStatus(new Path(pathname))) .filter(FileStatus::isDirectory) .map(x -> x.getPath().toString()) .collect(Collectors.toList()); } private  HdfsUtils(); }
HdfsUtils { public static List<String> listDirs(Configuration hadoopConf, String pathname) throws IOException { return Arrays .stream(FileSystem.get(hadoopConf).listStatus(new Path(pathname))) .filter(FileStatus::isDirectory) .map(x -> x.getPath().toString()) .collect(Collectors.toList()); } private  HdfsUtils(); static void remove(Configuration hadoopConf, String pathname); static List<String> listDirs(Configuration hadoopConf, String pathname); static int countFiles(Configuration hadoopConf, String pathname, PathFilter pathFilter); }
HdfsUtils { public static List<String> listDirs(Configuration hadoopConf, String pathname) throws IOException { return Arrays .stream(FileSystem.get(hadoopConf).listStatus(new Path(pathname))) .filter(FileStatus::isDirectory) .map(x -> x.getPath().toString()) .collect(Collectors.toList()); } private  HdfsUtils(); static void remove(Configuration hadoopConf, String pathname); static List<String> listDirs(Configuration hadoopConf, String pathname); static int countFiles(Configuration hadoopConf, String pathname, PathFilter pathFilter);  }