Java Is File Name Valid isValidFileName(final String aFileName)

Here you can find the source of isValidFileName(final String aFileName)

Description

is Valid File Name

License

Open Source License

Declaration

public static boolean isValidFileName(final String aFileName) 

Method Source Code


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

import java.io.File;
import java.io.IOException;

public class Main {
    public static boolean isValidFileName(final String aFileName) {
        final File aFile = new File(aFileName);
        boolean isValid = true;
        try {//from   w  ww  .j av  a2s.  com
            if (aFile.createNewFile()) {
                aFile.delete();
            }
        } catch (IOException e) {
            isValid = false;
        }
        return isValid;
    }
}

Related

  1. isValidFileName(String fileName)
  2. isValidFileName(String fileName)
  3. isValidFileName(String input)
  4. isValidFileName(String paramString)