Here you can find the source of isFileExist(String file)
Parameter | Description |
---|---|
file | - full path file name |
public static boolean isFileExist(String file)
//package com.java2s; //License from project: Open Source License import java.io.File; public class Main { /**//from w w w . j av a 2s .com * isFileExist method check file existance * * @param file - full path file name * @return true/false if file exists or does not exist */ public static boolean isFileExist(String file) { File f = new File(file); if (f == null) return false; if (f.exists() && !f.isDirectory()) return true; else return false; } public static boolean isDirectory(String trg, String str) { String tmp = str.substring(str.length() - 1, str.length()); if (tmp.equals("/")) // directory check //$NON-NLS-1$ { String dir = trg + File.separator + str.substring(0, str.length() - 1); File fl = new File(dir); fl.mkdirs(); return true; } return false; } }