Java File Exist fileExists(String fName)

Here you can find the source of fileExists(String fName)

Description

Test if a file exists or not

License

MIT License

Declaration

public static boolean fileExists(String fName) 

Method Source Code

//package com.java2s;
/*******************************************************************************
 *  Copyright ? 2012-2015 eBay Software Foundation
 *  This program is dual licensed under the MIT and Apache 2.0 licenses.
 *  Please see LICENSE for more information.
 *******************************************************************************/

import java.io.File;

public class Main {
    /**//from w w w. j av a  2 s .c o m
     * Test if a file exists or not
     */
    public static boolean fileExists(String fName) {
        boolean result = false;

        File file = new File(fName);
        if (file != null) {
            result = file.exists() && file.isFile();
        }

        return result;

    }
}

Related

  1. FileExists(String fileName)
  2. FileExists(String filePath)
  3. fileExists(String filepath)
  4. fileExists(String filePath)
  5. fileExists(String filePathString)
  6. fileExists(String folderPath, String fileName)
  7. fileExists(String name)
  8. fileExists(String parentDirectory, String filename)
  9. fileExists(String path)