Here you can find the source of isFileExist(String pathAndFileName)
Parameter | Description |
---|---|
pathAndFileName | - name of file and FULL path for it |
public static boolean isFileExist(String pathAndFileName)
/**************************************************************************** * Copyright (C) 2014 GGA Software Services LLC * * This file may be distributed and/or modified under the terms of the * GNU General Public License version 3 as published by the Free Software * Foundation.//from w ww.j a v a 2 s . c o m * * This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE * WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. * * You should have received a copy of the GNU General Public License * along with this program; if not, see <http://www.gnu.org/licenses>. ***************************************************************************/ import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.CookieStore; import org.apache.http.client.methods.HttpGet; import org.apache.http.impl.client.BasicCookieStore; import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.cookie.BasicClientCookie; import org.openqa.selenium.Cookie; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; import java.util.Set; public class Main{ /** * Tests whether the file denoted by this abstract pathname is a normal * file. A file is <em>normal</em> if it is not a directory and, in * addition, satisfies other system-dependent criteria. Any non-directory * file created by a Java application is guaranteed to be a normal file. * * @param pathAndFileName - name of file and FULL path for it * * @return * - true if file exists and * - false if file absense default directory(path) for downloaded files * - true if and only if the file denoted by this abstract pathname exists and is a normal file; * - false otherwise */ public static boolean isFileExist(String pathAndFileName) { ReporterNGExt.logTechnical(String.format("isFileExist: %s", pathAndFileName)); File findFile = new File(pathAndFileName); return findFile.isFile(); } }