Java File Exist fileExists(String aFilename)

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

Description

Helper method to check for file existence

License

Open Source License

Parameter

Parameter Description
aFilename the filename to be checked

Declaration

public static boolean fileExists(String aFilename) 

Method Source Code

//package com.java2s;

import java.io.File;

public class Main {
    /**/*w w w .j  av a2 s.co  m*/
     * Helper method to check for file existence
     * @param aFilename the filename to be checked
     */
    public static boolean fileExists(String aFilename) {
        boolean exists = false;

        try {
            exists = new File(aFilename).exists();
        } catch (Throwable th) {
            // Ignore exception, failure is good enough
        }

        return exists;
    }
}

Related

  1. fileExists(File path)
  2. fileExists(final String path)
  3. fileExists(final String path)
  4. fileExists(final String pathname)
  5. fileExists(String absolutePathAndFileName)
  6. fileExists(String file)
  7. FileExists(String file)
  8. fileExists(String filename)
  9. fileExists(String filename)