Class IfAccumulatedFileSize

  • All Implemented Interfaces:
    PathCondition

    @Plugin(name="IfAccumulatedFileSize",
            category="Core",
            printObject=true)
    public final class IfAccumulatedFileSize
    extends java.lang.Object
    implements PathCondition
    PathCondition that accepts paths after the accumulated file size threshold is exceeded during the file tree walk.
    • Method Detail

      • getThresholdBytes

        public long getThresholdBytes()
      • getNestedConditions

        public java.util.List<PathCondition> getNestedConditions()
      • accept

        public boolean accept​(java.nio.file.Path basePath,
                              java.nio.file.Path relativePath,
                              java.nio.file.attribute.BasicFileAttributes attrs)
        Description copied from interface: PathCondition
        Returns true if the specified candidate path should be deleted, false otherwise.
        Specified by:
        accept in interface PathCondition
        Parameters:
        basePath - the directory from where to start scanning for deletion candidate files
        relativePath - the candidate for deletion. This path is relative to the baseDir.
        attrs - attributes of the candidate path
        Returns:
        whether the candidate path should be deleted
      • beforeFileTreeWalk

        public void beforeFileTreeWalk()
        Description copied from interface: PathCondition
        Invoked before a new file tree walk is started. Stateful PathConditions can reset their state when this method is called.
        Specified by:
        beforeFileTreeWalk in interface PathCondition
      • createFileSizeCondition

        @PluginFactory
        public static IfAccumulatedFileSize createFileSizeCondition​(@PluginAttribute("exceeds")
                                                                    java.lang.String size,
                                                                    @PluginElement("PathConditions")
                                                                    PathCondition... nestedConditions)
        Create an IfAccumulatedFileSize condition.
        Parameters:
        threshold - The threshold accumulated file size from which files will be deleted.
        Returns:
        An IfAccumulatedFileSize condition.
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object