Java Is File Name Valid isValidFileName(String input)

Here you can find the source of isValidFileName(String input)

Description

is Valid File Name

License

Open Source License

Return

true if input is not null and contains no path separator

Declaration

private static boolean isValidFileName(String input) 

Method Source Code

//package com.java2s;
/* *******************************************************************
 * Copyright (c) 1999-2001 Xerox Corporation, 
 *               2002 Palo Alto Research Center, Incorporated (PARC).
 * All rights reserved. //from   w ww  .  ja v a  2 s . c o m
 * This program and the accompanying materials are made available 
 * under the terms of the Eclipse Public License v1.0 
 * which accompanies this distribution and is available at 
 * http://www.eclipse.org/legal/epl-v10.html 
 *  
 * Contributors: 
 *     Xerox/PARC     initial implementation 
 * ******************************************************************/

import java.io.File;

public class Main {
    /** @return true if input is not null and contains no path separator */
    private static boolean isValidFileName(String input) {
        return ((null != input) && (-1 == input.indexOf(File.pathSeparator)));
    }
}

Related

  1. isValidFileName(final String aFileName)
  2. isValidFileName(String fileName)
  3. isValidFileName(String fileName)
  4. isValidFileName(String paramString)
  5. isValidFilePath(String filePath)