Exemplo n.º 1
0
  /**
   * IOFileFilter <br>
   * Created on: Nov 29, 2012 9:32:51 AM
   *
   * @param filePath
   * @param fileFilter
   * @return
   */
  public static Collection<File> getFiles(String filePath, IOFileFilter fileFilter) {

    NameFileComparator comp = new NameFileComparator();
    File[] fileArr =
        comp.sort(
            FileUtils.convertFileCollectionToFileArray(
                FileUtils.listFiles((new File(filePath)), fileFilter, TrueFileFilter.INSTANCE)));
    comp = null;

    return new LinkedList<File>(Arrays.asList(fileArr));
  }
Exemplo n.º 2
0
  /**
   * Suffix <br>
   * Created on: Nov 28, 2012 1:50:50 PM
   *
   * @param filePath
   * @param nameFix
   * @param newerTime
   * @param isOlder true : all file ,false : newer file
   * @return
   */
  public static Collection<File> getSuffixAndNewerFiles(
      String filePath, String nameFix, long newerTime, boolean isOlder) {

    IOFileFilter wildcardFileFilter = new SuffixFileFilter(nameFix);
    IOFileFilter ageFileFilter = new AgeFileFilter(newerTime, isOlder);
    IOFileFilter andFilter = FileFilterUtils.and(wildcardFileFilter, ageFileFilter);

    NameFileComparator comp = new NameFileComparator();
    File[] fileArr =
        comp.sort(
            FileUtils.convertFileCollectionToFileArray(
                FileUtils.listFiles((new File(filePath)), andFilter, TrueFileFilter.INSTANCE)));
    comp = null;

    return new LinkedList<File>(Arrays.asList(fileArr));
  }
Exemplo n.º 3
0
 public static File[] convertFileCollectionToFileArray(Collection files) {
   return FileUtils.convertFileCollectionToFileArray(files);
 }