net.sf.jfilesync.service.unify
Class UnifyFile
java.lang.Object
net.sf.jfilesync.engine.BasicFile
net.sf.jfilesync.service.unify.UnifyFile
public class UnifyFile
- extends BasicFile
| Methods inherited from class net.sf.jfilesync.engine.BasicFile |
addChild, getAbsolutePath, getChildren, getFileModTime, getFileName, getFileSize, getPathControl, getRelativePathToRoot, getRootPath, getTFileProperties, hasChild, hasChildren, isDirectory, print, setRootPath |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
messageDigest
private byte[] messageDigest
messageSmallDigest
private byte[] messageSmallDigest
duplicates
private java.util.List<UnifyFile> duplicates
keepIt
private boolean keepIt
UnifyFile
public UnifyFile(TFileProperties file,
java.lang.String rootPath,
TPathControlInterface pathControl)
getMessageDigest
public byte[] getMessageDigest()
setMessageDigest
public void setMessageDigest(byte[] messageDigest)
hasSameDigest
public boolean hasSameDigest(byte[] digest)
hasDigest
public boolean hasDigest()
setMessagePreDigest
public void setMessagePreDigest(byte[] digest)
hasSamePreDigest
public boolean hasSamePreDigest(byte[] digest)
hasPreDigest
public boolean hasPreDigest()
getPreDigest
public byte[] getPreDigest()
isDuplicateOf
public boolean isDuplicateOf(UnifyFile otherFile)
- this method is required since only comparing the digest is not
enough to detect duplicates
if a file has a size of 0 then the digest is useless
in this case we compare the file names
- Parameters:
otherFile -
- Returns:
addDuplicate
public void addDuplicate(UnifyFile file)
getDuplicates
public UnifyFile[] getDuplicates()
setKeepIt
public void setKeepIt(boolean keepIt)
getKeepIt
public boolean getKeepIt()
hasDuplicates
public boolean hasDuplicates()
getAbsoluteTargetFileName
public java.lang.String getAbsoluteTargetFileName(java.lang.String targetPath)
clone
public UnifyFile clone()
- Specified by:
clone in class BasicFile
getDuplicatesInfo
public DuplicatesInfo getDuplicatesInfo()
- Returns:
- returns true if file is dir and contains a file with duplicates
keepAllChildren
public void keepAllChildren(boolean deleteDuplicates)
keepAllChildrenAndDeleteDuplicates
private void keepAllChildrenAndDeleteDuplicates(BasicFile root)