Package org.kendar.sync.lib.model
Class FileInfo
java.lang.Object
org.kendar.sync.lib.model.FileInfo
Represents metadata about a file.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic FileInfoCreates a FileInfo object from a file.static FileInfointgetPath()longgetSize()inthashCode()voidsetCreationTime(Instant creationTime) voidsetExtendedUmask(int extendedUmask) voidsetModificationTime(Instant modificationTime) voidvoidsetRelativePath(String relativePath) voidsetSize(long size) Gets the file represented by this FileInfo.toLine()toString()
-
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 filerelativePath- The path relative to the base directorysize- The size of the file in bytescreationTime- The creation time of the filemodificationTime- The last modification time of the fileextendedUmask- Whether the file is a directory
-
-
Method Details
-
fromFile
Creates a FileInfo object from a file.- Parameters:
file- The filebaseDir- The base directory for calculating the relative path- Returns:
- A new FileInfo object
- Throws:
IOException- If an I/O error occurs
-
fromLine
-
toFile
Gets the file represented by this FileInfo.- Parameters:
baseDir- The base directory to resolve the relative path against- Returns:
- The file
-
getPath
-
setPath
-
getRelativePath
-
setRelativePath
-
getSize
public long getSize() -
setSize
public void setSize(long size) -
getCreationTime
-
setCreationTime
-
getModificationTime
-
setModificationTime
-
getExtendedUmask
public int getExtendedUmask() -
setExtendedUmask
public void setExtendedUmask(int extendedUmask) -
equals
-
hashCode
public int hashCode() -
toString
-
toLine
-