Java 8 FileFilter - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 FileFilter class.

This code example shows how to use the following methods:accept
	public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
		File selectedFile = this.files[(int) id];
		if (selectedFile.isDirectory()) {
			this.currentDirectory = selectedFile;
			browseToCurrentDirectory(); 
		} else if (fileSelectFilter == null || fileSelectFilter.accept(selectedFile)) {
            Intent returnIntent = new Intent();
            returnIntent.putExtra("selectedFile", selectedFile
                    .getAbsolutePath());
            returnIntent.putExtra("class", this.viewerClassName);
             
            setResult(RESULT_OK, returnIntent);
			finish();
		} else { 
			showDialog(DIALOG_FILE_INVALID);
		} 
	} 
 
	/** 
	 * Browses to the current directory. 
5
CodeRank
This code example shows how to use the following methods:accept
  public Collection<File> getFiles() {
    return myContainer;
  } 
 
  public boolean apply(Module module, File file, String sourceRoot) throws Exception {
    if (myFilter.accept(file)) {
      myContainer.add(file);
    } 
    return true; 
  } 
} 
5
CodeRank
This code example shows how to use the following methods:accept
		return accept(FileWrapper.toFile(res));
	} 
 
	@Override 
	public boolean accept(File pathname) {
		return filter.accept(pathname);
	} 
 
} 
5
CodeRank
This code example shows how to use the following methods:accept
        this.filter = filter;
    } 
 
    @Override 
    public boolean accept(File file) {
        return !filter.accept(file);
    } 
 
} 
5
CodeRank
This code example shows how to use the following methods:accept
     * 
     * @param file The file 
     * @return true if the file is acceptable 
     */ 
    public boolean accept(File file) {
      return f1.accept(file) && f2.accept(file);
    } 
 
  } 
 
 
  /** 
   * Implements a negation file filter. 
   */ 
  private static class NegationFileFilter implements java.io.FileFilter {
 
    private final FileFilter f1;
 
    /** 
     * Sets up file filter. 
5
CodeRank
This code example shows how to use the following methods:accept
 
public abstract class AbstractMetadataExtractor implements MetadataExtractor { 
	@Override 
	public boolean canExtractFrom(File moduleDirectory, FileFilter filter) {
		File mdSource = new File(moduleDirectory, getPrimarySource());
		return filter.accept(mdSource) && mdSource.exists();
	} 
 
	@Override 
	public boolean hasTypesAndProviders() { 
		return false; 
	} 
 
	@Override 
	public Metadata parseMetadata(File moduleDirectory, boolean includeTypesAndChecksums, FileFilter filter,
			File[] extractedFrom, Diagnostic result) throws IOException {
		File metadataFile = new File(moduleDirectory, getPrimarySource());
		if(extractedFrom != null)
			extractedFrom[0] = metadataFile;
 
5
CodeRank
This code example shows how to use the following methods:accept
     * @param file  the file to check 
     * @return true if the filter matches 
     */ 
    public boolean accept(File file) {
        if (fileFilter != null) {
            return fileFilter.accept(file);
        } else { 
            return super.accept(file);
        } 
    } 
 
    /** 
     * Checks the filter. 
     *  
     * @param dir  the directory 
     * @param name  the filename in the directory 
     * @return true if the filter matches 
     */ 
    public boolean accept(File dir, String name) {
        if (filenameFilter != null) {
5
CodeRank
This code example shows how to use the following methods:accept
		L.info(logger, "Read files from " + ArrayUtils.join2(directories)); 
		List<File> filteredFiles = new ArrayList<File>(); 
		IOFileFilter ioFileFilter = new IOFileFilter() { 
 
			public boolean accept(File file) { 
				return fileFilter.accept(file); 
			} 
 
			public boolean accept(File dir, String name) { 
				return fileFilter.accept(new File(dir, name)); 
			} 
		}; 
		for (String dirName : directories) { 
			File dir = new File(dirName); 
			// File[] files = dir.listFiles(fileFilter); 
			Collection<File> files = FileUtils.listFiles(dir, ioFileFilter, 
					recursive ? TrueFileFilter.INSTANCE : null); 
			// Collection<File> files = FileUtils.listFiles(dir, null, 
			// recursive); 
			if (files == null) { 
3
CodeRank
This code example shows how to use the following methods:accept
		public AFFileFilter(FileFilter proxy) {
			this.proxy = proxy;
		} 
 
		public boolean accept(File pathname) {
			if (proxy.accept(pathname)) {
				return true; 
			} 
			return false; 
		} 
 
		public Object clone() {
			return new AFFileFilter(this.proxy);
		} 
 
		public String toString() {
			return "AssetFinder.AFFileFilter " 
					+ Log.tryToString("", this.proxy);
		} 
	} 
4
CodeRank
This code example shows how to use the following methods:accept
     * @param file  the file to check 
     * @return true if the filter matches 
     */ 
    public boolean accept(File file) {
        if (fileFilter != null) {
            return fileFilter.accept(file);
        } else { 
            return super.accept(file);
        } 
    } 
 
    /** 
     * Checks the filter. 
     *  
     * @param dir  the directory 
     * @param name  the filename in the directory 
     * @return true if the filter matches 
     */ 
    public boolean accept(File dir, String name) {
        if (filenameFilter != null) {
4
CodeRank

Related Java 8 FileFilter Questions & Answers:

See Code Examples for Java 8 FileFilter Methods: