List of usage examples for java.io File isFile
public boolean isFile()
From source file:Main.java
/** * @author Ian Copland//from w w w . ja v a 2 s . c om * * @param in_context - The current context. * @param in_filePath - The file path. * * @return Whether or not the given file exists in internal storage. */ public static boolean doesFileExist(Context in_context, String in_filePath) { File file = in_context.getFileStreamPath(in_filePath); if (file.exists() == true && file.isFile() == true) { return true; } return false; }
From source file:Main.java
public static void addPluginIfMatches(File folderOrJar, String bundleName, Collection<File> result) { String name = folderOrJar.getName(); if (folderOrJar.isFile()) { if (name.equals(bundleName + ".jar") || name.startsWith(bundleName + "_") && name.endsWith(".jar")) result.add(folderOrJar);/*from w ww . j av a 2 s . com*/ } else { if (name.equals(bundleName) || name.startsWith(bundleName + "_")) result.add(folderOrJar); } }
From source file:com.hangum.tadpole.engine.initialize.ApplicationLicenseInitialize.java
public static void load() { if (ApplicationArgumentUtils.isInitialize) return;/*from www .j av a 2 s . com*/ try { String strLicenseInfo = ApplicationArgumentUtils.initDBServer(); if (!StringUtils.isEmpty(strLicenseInfo)) { logger.info("******** [0] Start enterprise version "); LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler(); linceseHandler.license(strLicenseInfo); } else { File fileExist = new File(TDB_License_FILE); if (fileExist.isFile()) { logger.info("******** [1] Start enterprise version "); LicenseExtensionHandler linceseHandler = new LicenseExtensionHandler(); linceseHandler.license(fileExist); } } ApplicationArgumentUtils.isInitialize = true; } catch (Exception e) { logger.error("System initialize exception", e); MessageDialog.openError(null, "Error", "License validation exception\n" + e.getMessage()); System.exit(0); } }
From source file:Main.java
public static void getScripts(File project, Vector<String> scripts, String projectPath) throws IOException { if (project != null && project.isFile()) { String canonicalPath = project.getCanonicalPath(); //System.out.println("bbbbbbbbbbb:" + canonicalPath + " " + projectPath); int index = canonicalPath.indexOf(projectPath);//lastIndexOf(System.getProperty("file.separator") + "workspace" + System.getProperty("file.separator")); String relativePath = canonicalPath.substring(projectPath.length(), canonicalPath.length()); //System.out.println("bbbbbbbbbbb:" + relativePath); //scripts.add(project.getCanonicalPath()); scripts.add(relativePath);//from w w w.j a v a 2 s . c o m } else if (project != null && project.isDirectory()) { File[] files = project.listFiles(); for (int i = 0; i < files.length; i++) { getScripts(files[i], scripts, projectPath); } } }
From source file:com.denimgroup.threadfix.csv2ssl.parser.CSVToSSVLParser.java
public static String parse(String filePath, String... format) { File file = new File(filePath); assert file.isFile() : "File should already have been checked at this point."; boolean excel = Configuration.isExcel(file); if (excel) {//from w w w .j a v a 2 s. c o m return parseExcel(file, format); } else { return parseCsv(file, format); } }
From source file:Main.java
private static HashMap<String, Object> getPossibleOriginalXlzSourceFile(File file) { HashMap<String, Object> result = new HashMap<String, Object>(); File wantedFile = file;//w w w . j a va2 s. c o m Boolean isFromXlzFile = false; try { File parentFile = file.getParentFile(); File grandFile = parentFile.getParentFile(); File f = new File(grandFile, parentFile.getName() + ".xlz"); if (f.exists() && f.isFile()) { wantedFile = f; isFromXlzFile = true; } } catch (Exception e) { } result.put("sourceFile", wantedFile); result.put("isFromXlzFile", isFromXlzFile); return result; }
From source file:com.xemantic.tadedon.guice.configuration.GuiceConfigurations.java
public static void bindConfiguration(Binder binder, File confDir) { checkArgument(confDir.isDirectory(), "confDir must be directory: %s", confDir); for (File file : confDir.listFiles()) { if (file.isFile()) { bindConfiguration(binder, file.getName(), Configurations.getConfiguration(file)); }// w ww.j av a 2s.c om } }
From source file:Main.java
private static boolean deleteFilesInDir(final File dir) { if (dir == null) return false; // dir doesn't exist then return true if (!dir.exists()) return true; // dir isn't a directory then return false if (!dir.isDirectory()) return false; File[] files = dir.listFiles(); if (files != null && files.length != 0) { for (File file : files) { if (file.isFile()) { if (!file.delete()) return false; } else if (file.isDirectory()) { if (!deleteDir(file)) return false; }//from w w w. j a v a 2 s .co m } } return true; }
From source file:Main.java
private static boolean deleteDir(final File dir) { if (dir == null) return false; // dir doesn't exist then return true if (!dir.exists()) return true; // dir isn't a directory then return false if (!dir.isDirectory()) return false; File[] files = dir.listFiles(); if (files != null && files.length != 0) { for (File file : files) { if (file.isFile()) { if (!file.delete()) return false; } else if (file.isDirectory()) { if (!deleteDir(file)) return false; }/* ww w .jav a2s . c o m*/ } } return dir.delete(); }
From source file:Main.java
public static boolean deleteFile(File file) { if (sdState.equals(Environment.MEDIA_MOUNTED)) { if (file.exists()) { if (file.isFile()) { return file.delete(); }//from w w w .j a v a 2s .co m } else { return true; // file not exist } } return false; }