Java Utililty Methods Is File Name Valid

List of utility methods to do Is File Name Valid

Description

The list of methods to do Is File Name Valid are organized into topic(s).

Method

booleanisValidFileName(final String aFileName)
is Valid File Name
final File aFile = new File(aFileName);
boolean isValid = true;
try {
    if (aFile.createNewFile()) {
        aFile.delete();
} catch (IOException e) {
    isValid = false;
...
booleanisValidFileName(String fileName)
This method checks if a String represents a valid File name.
File f = new File(fileName);
try {
    f.getCanonicalPath();
    return true;
} catch (IOException e) {
    return false;
booleanisValidFileName(String fileName)
is Valid File Name
if (fileName == null || fileName.length() == 0) {
    return false;
for (char c : ILLEGAL_CHARACTERS) {
    if (fileName.indexOf(c) != -1) {
        return false;
File f = new File(fileName);
try {
    f.getCanonicalPath();
    return true;
} catch (IOException e) {
    return false;
booleanisValidFileName(String input)
is Valid File Name
return ((null != input) && (-1 == input.indexOf(File.pathSeparator)));
booleanisValidFileName(String paramString)
is Valid File Name
boolean rtn = false;
if (paramString != null) {
    File localFile = new File(paramString);
    try {
        if (localFile.getCanonicalPath() != null) {
            rtn = true;
    } catch (IOException ex) {
...
booleanisValidFilePath(String filePath)
Checks is file path is valid
if (isNullOrEmpty(filePath)) {
    return false;
String path = filePath.trim();
File file = new File(path);
if ((!file.exists()) || file.isDirectory()) {
    return false;
} else {
...