com.mucommander.job
Class FileCollisionChecker

java.lang.Object
  extended by com.mucommander.job.FileCollisionChecker

public class FileCollisionChecker
extends java.lang.Object

The purpose of this class is to check for collisions between a source and destination file used in a file transfer.

Currently, 3 collision types are detected:

The value returned by checkForCollision(com.mucommander.file.AbstractFile, com.mucommander.file.AbstractFile) can be used to create a FileCollisionDialog in order to inform the user of the collision and ask him how to resolve it.

Author:
Maxence Bernard
See Also:
FileCollisionDialog

Field Summary
static int DESTINATION_FILE_ALREADY_EXISTS
          The destination file already exists and is not a directory
static int NO_COLLOSION
          No collision detected
static int SAME_SOURCE_AND_DESTINATION
          Source and destination files are the same
static int SOURCE_PARENT_OF_DESTINATION
          Source and destination are both folders and destination is a subfolder of source
 
Constructor Summary
FileCollisionChecker()
           
 
Method Summary
static int checkForCollision(AbstractFile sourceFile, AbstractFile destFile)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_COLLOSION

public static final int NO_COLLOSION
No collision detected

See Also:
Constant Field Values

DESTINATION_FILE_ALREADY_EXISTS

public static final int DESTINATION_FILE_ALREADY_EXISTS
The destination file already exists and is not a directory

See Also:
Constant Field Values

SAME_SOURCE_AND_DESTINATION

public static final int SAME_SOURCE_AND_DESTINATION
Source and destination files are the same

See Also:
Constant Field Values

SOURCE_PARENT_OF_DESTINATION

public static final int SOURCE_PARENT_OF_DESTINATION
Source and destination are both folders and destination is a subfolder of source

See Also:
Constant Field Values
Constructor Detail

FileCollisionChecker

public FileCollisionChecker()
Method Detail

checkForCollision

public static int checkForCollision(AbstractFile sourceFile,
                                    AbstractFile destFile)
Parameters:
sourceFile - source file, can be null in which case the only collision checked against is DESTINATION_FILE_ALREADY_EXISTS.
destFile - destination file, cannot be null
Returns:
an int describing the collision type, or NO_COLLOSION if no collision was detected (see constants)


This file is part of muCommander - Copyright (C) 2002-2008 Maxence Bernard