Class FileInfo

java.lang.Object
org.graylog2.plugin.utilities.FileInfo

public abstract class FileInfo extends Object
A FileInfo presents a concise way of checking for file modification based on its file system attributes.

Construct it via its forPath(Path) method and later use the checkForChange() method whenever you want to act if a modification has occurred. The returned FileInfo.Change object contains whether the file has actually changed and the new file info object to use in future checks.

  • Constructor Details

    • FileInfo

      public FileInfo()
  • Method Details

    • key

      @Nullable public abstract Object key()
    • size

      public abstract long size()
    • modificationTime

      @Nullable public abstract FileTime modificationTime()
    • path

      public abstract Path path()
    • toBuilder

      protected abstract FileInfo.Builder toBuilder()
    • builder

      public static FileInfo.Builder builder()
    • forPath

      @NotNull public static @NotNull FileInfo forPath(Path path)
      Create a file info for the given path.
      Parameters:
      path - the path must exist, otherwise an IllegalArgumentException is thrown
      Returns:
      the file info object
    • empty

      @NotNull public static @NotNull FileInfo empty()
    • checkForChange

      @NotNull public FileInfo.Change checkForChange()