Java File Exist fileExistsAndReadable(String file)

Here you can find the source of fileExistsAndReadable(String file)

Description

Checks file existence

License

Apache License

Parameter

Parameter Description
file a parameter

Declaration

public static boolean fileExistsAndReadable(String file) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;

public class Main {
    /**// www.j a  va 2  s  .  c  o  m
     * Checks file existence
     * @param file
     */
    public static boolean fileExistsAndReadable(String file) {
        File f = new File(file);
        boolean res = (!f.isFile() || !f.canRead()) ? false : true;
        return res;
    }
}

Related

  1. fileExists(String path, boolean throwException)
  2. fileExists(String path, String fileName)
  3. fileExists(String s)
  4. fileExistsAndCanRead(final String filePath)
  5. fileExistsAndIsExecutable(String filePathString)
  6. fileExistsAndReadable(String sourcePath)
  7. FileExistsNotEmpty(String filename)
  8. isFileExist(File file)
  9. isFileExist(File file, File folder)