public static boolean isFileExist(String filePath,FileType fileType) throws IOException {
  filePath=filePath.replace("\\","/");
switch (fileType) {
case HDFS:
case VIEWFS:
    Path path=new Path(filePath);
  FileSystem fs=path.getFileSystem(configuration);
return fs.exists(path);
case LOCAL:
default :
File defaultFile=new File(filePath);
return defaultFile.exists();
}
}

public static boolean isFileExist ( String filePath , FileType fileType ) throws IOException { filePath = filePath . replace ( "\\" , "/" ) ; switch ( fileType ) { case HDFS : case VIEWFS : Path path = new Path ( filePath ) ; FileSystem fs = path . getFileSystem ( configuration ) ; return fs . exists ( path ) ; case LOCAL : default : File defaultFile = new File ( filePath ) ; return defaultFile . exists ( ) ; } }
this method checks the given path exists or not and also is it file or not if the performfilecheck is true
