List of usage examples for java.io File getName
public String getName()
From source file:com.genuitec.eclipse.gerrit.tools.internal.gps.GpsQuickImportFiles.java
public static void addGpsFile(File file) { assert file.getName().endsWith(".gps"); //$NON-NLS-1$ synchronized (files) { files.add(file);//from w ww .j a v a 2 s. c om store(); } }
From source file:com.hp.test.framework.jmeterTests.GetJmeterTestCaseFileList.java
public static List getjmeterTestcaseList() { List<String> jmeterFileList; jmeterFileList = new ArrayList<String>(); ReadJmeterConfigProps readjmeterconfigprops = new ReadJmeterConfigProps(); String path = readjmeterconfigprops.getProperty("location.java.files"); File dir = new File(path); FileFilter fileFilter = new WildcardFileFilter("*.java"); File[] files = dir.listFiles(fileFilter); for (File file : files) { jmeterFileList.add(file.getName()); }// ww w.jav a2 s .co m return jmeterFileList; }
From source file:Main.java
public static boolean isMP3File(File in) { boolean retVal = isMP3File(in.getName()); return retVal; }
From source file:Main.java
public static boolean isOGGFile(File in) { boolean retVal = isOGGFile(in.getName()); return retVal; }
From source file:Main.java
public static boolean isM4AFile(File in) { boolean retVal = isM4AFile(in.getName()); return retVal; }
From source file:Main.java
public static void listFilesInDirectory(File dir) throws Exception { String tempfolder = System.getProperty("java.io.tmpdir"); String pathRequiredForFile = null; File[] files = dir.listFiles(); if (files == null) { return;//from w ww . j a va 2 s. c om } for (File f : files) { if (f.isDirectory()) { pathRequiredForFile = f.getName(); listFilesInDirectory(f); } else { System.out.println(f.getName()); File path = new File(tempfolder + "//" + pathRequiredForFile); path.mkdir(); OutputXml(f, path.getAbsolutePath()); } } }
From source file:Main.java
public static int cpuNums() { int nums = 1; try {//from w w w. j av a 2 s .c o m File file = new File("/sys/devices/system/cpu/"); File[] files = file.listFiles(new FileFilter() { @Override public boolean accept(File arg0) { if (Pattern.matches("cpu[0-9]", arg0.getName())) { return true; } return false; } }); nums = files.length; } catch (Exception e) { e.printStackTrace(); } return nums; }
From source file:Main.java
public static boolean isSupportedAudioFormat(File file) { return isSupportedAudioFormat(file.getName()); }
From source file:Main.java
/** * Gets the opf file name./*w w w . ja v a 2 s .co m*/ * * @param path the folder contains file opf. * @return the opf file name */ public static String getOpfFileName(String path) { String fileName = null; File folder = new File(path); if (folder.isDirectory()) { File[] listOfFiles = folder.listFiles(); if (listOfFiles != null) { for (File file : listOfFiles) { if (file.isFile() && file.getName().endsWith(".opf")) { fileName = file.getName(); break; } } } } return fileName; }
From source file:Main.java
public static File[] listBackups(File backupPath) { if (!backupPath.isDirectory() || !backupPath.canRead()) { return new File[0]; }/*ww w . j a v a 2s. c om*/ File[] files = backupPath.listFiles(new FilenameFilter() { @Override public boolean accept(File dir, String filename) { return (new File(dir, filename)).isFile() && filename.endsWith(".backup"); } }); if (files != null) { Arrays.sort(files, new Comparator<File>() { @Override public int compare(File s1, File s2) { return s2.getName().compareTo(s1.getName()); } }); return files; } else { return new File[0]; } }