Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,19 @@
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.fs.PathFilter;

/**
* A {@link PathFilter} that filters out hidden files. A file is considered to
* be hidden, and should not be considered for processing, when the file name
* starts with a period ('.') or an underscore ('_').
*/
public class HiddenFileFilter implements PathFilter {
public static final HiddenFileFilter INSTANCE = new HiddenFileFilter();

private HiddenFileFilter() {}

@Override
public boolean accept(Path p) {
return !p.getName().startsWith("_") && !p.getName().startsWith(".");
final char c = p.getName().charAt(0);
return c != '.' && c != '_';
}
}