Class FileInfo

java.lang.Object
org.kendar.sync.lib.model.FileInfo

public class FileInfo extends Object
Represents metadata about a file.
  • Constructor Details

    • FileInfo

      public FileInfo()
    • FileInfo

      public FileInfo(String path, String relativePath, long size, Instant creationTime, Instant modificationTime, int extendedUmask)
      Creates a new file info object.
      Parameters:
      path - The absolute path of the file
      relativePath - The path relative to the base directory
      size - The size of the file in bytes
      creationTime - The creation time of the file
      modificationTime - The last modification time of the file
      extendedUmask - Whether the file is a directory
  • Method Details

    • fromFile

      public static FileInfo fromFile(File file, String baseDir) throws IOException
      Creates a FileInfo object from a file.
      Parameters:
      file - The file
      baseDir - The base directory for calculating the relative path
      Returns:
      A new FileInfo object
      Throws:
      IOException - If an I/O error occurs
    • fromLine

      public static FileInfo fromLine(String fileLine)
    • toFile

      public File toFile(String baseDir)
      Gets the file represented by this FileInfo.
      Parameters:
      baseDir - The base directory to resolve the relative path against
      Returns:
      The file
    • getPath

      public String getPath()
    • setPath

      public void setPath(String path)
    • getRelativePath

      public String getRelativePath()
    • setRelativePath

      public void setRelativePath(String relativePath)
    • getSize

      public long getSize()
    • setSize

      public void setSize(long size)
    • getCreationTime

      public Instant getCreationTime()
    • setCreationTime

      public void setCreationTime(Instant creationTime)
    • getModificationTime

      public Instant getModificationTime()
    • setModificationTime

      public void setModificationTime(Instant modificationTime)
    • getExtendedUmask

      public int getExtendedUmask()
    • setExtendedUmask

      public void setExtendedUmask(int extendedUmask)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • toLine

      public String toLine()