Java Is Legal File Path isLegalFile(String filePath)

Here you can find the source of isLegalFile(String filePath)

Description

is Legal File

License

Open Source License

Declaration

public static boolean isLegalFile(String filePath) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.File;

public class Main {

    public static boolean isLegalFile(String filePath) {
        File file = new File(filePath);
        if (!file.exists() || file.isDirectory() || !file.canRead()) {
            return false;
        }/*from  ww  w.  ja va2s.  c o m*/
        return true;
    }
}

Related

  1. isLegalDir(final String dirname)
  2. isLegalFilePath(File inBasePath, File inResourcePath)