private void appendFiles(FileSystem fs, Path path, Path base, PathFilter pathFilter, KeyProvider<K> keyProvider, Map<Path, K> addedFiles) throws IOException { if (fs.isFile(path)) { if (pathFilter == null || pathFilter.accept(path)) { final K key = keyProvider.getKey(fs, path, base); appendFile(key, fs, path); addedFiles.put(path, key); } } else { try { final FileStatus[] status = fs.listStatus(path); for (final FileStatus stat : status) { appendFiles(fs, stat.getPath(), base, pathFilter, keyProvider, addedFiles); } } catch (final Throwable e) { System.err.println("Failed listing status on path: " + path); } } }
private void appendFiles(FileSystem fs, Path path, Path base, PathFilter pathFilter, KeyProvider<K> keyProvider, Map<Path, K> addedFiles) throws IOException { if (fs.isFile(path)) { if (pathFilter == null || pathFilter.accept(path)) { final K key = keyProvider.getKey(fs, path, base); appendFile(key, fs, path); addedFiles.put(path, key); } } else { try { final FileStatus[] status = fs.listStatus(path); for (final FileStatus stat : status) { appendFiles(fs, stat.getPath(), base, pathFilter, keyProvider, addedFiles); } } catch (final Throwable e) { System.err.println("Failed listing status on path: " + path); } } }
private void appendFiles(final FileSystem fs, Path path, boolean recurse, PathFilter pathFilter, KeyProvider<K> keyProvider, Map<Path, K> addedFiles) throws IOException { if (fs.isFile(path)) { if (pathFilter == null || pathFilter.accept(path)) { final K key = keyProvider.getKey(fs, path); appendFile(key, fs, path); addedFiles.put(path, key); } } else if (recurse) { // fs.listStatus(path); final FileStatus[] status = fs.listStatus(path, new PathFilter() { @Override public boolean accept(Path potential) { try { fs.getStatus(potential); return true; } catch (final IOException e) { return false; } } }); for (final FileStatus stat : status) { appendFiles(fs, stat.getPath(), path.getParent(), pathFilter, keyProvider, addedFiles); } } }
private void appendFiles(final FileSystem fs, Path path, boolean recurse, PathFilter pathFilter, KeyProvider<K> keyProvider, Map<Path, K> addedFiles) throws IOException { if (fs.isFile(path)) { if (pathFilter == null || pathFilter.accept(path)) { final K key = keyProvider.getKey(fs, path); appendFile(key, fs, path); addedFiles.put(path, key); } } else if (recurse) { // fs.listStatus(path); final FileStatus[] status = fs.listStatus(path, new PathFilter() { @Override public boolean accept(Path potential) { try { fs.getStatus(potential); return true; } catch (final IOException e) { return false; } } }); for (final FileStatus stat : status) { appendFiles(fs, stat.getPath(), path.getParent(), pathFilter, keyProvider, addedFiles); } } }