Class SizeFileFilter

    • Constructor Detail

      • SizeFileFilter

        public SizeFileFilter​(long size)
        Constructs a new size file filter for files equal to or larger than a certain size.
        Parameters:
        size - the threshold size of the files
        Throws:
        IllegalArgumentException - if the size is negative
      • SizeFileFilter

        public SizeFileFilter​(long size,
                              boolean acceptLarger)
        Constructs a new size file filter for files based on a certain size threshold.
        Parameters:
        size - the threshold size of the files
        acceptLarger - if true, files equal to or larger are accepted, otherwise smaller ones (but not equal to)
        Throws:
        IllegalArgumentException - if the size is negative
    • Method Detail

      • accept

        public boolean accept​(File file)
        Checks to see if the size of the file is favorable.

        If size equals threshold and smaller files are required, file IS NOT selected. If size equals threshold and larger files are required, file IS selected.

        Specified by:
        accept in interface FileFilter
        Specified by:
        accept in interface IOFileFilter
        Overrides:
        accept in class AbstractFileFilter
        Parameters:
        file - the File to check
        Returns:
        true if the file name matches
      • toString

        public String toString()
        Provide a String representation of this file filter.
        Overrides:
        toString in class AbstractFileFilter
        Returns:
        a String representation