List of usage examples for java.io File getName
public String getName()
From source file:Main.java
public static boolean isFLACFile(File in) { return isFLACFile(in.getName()); }
From source file:Main.java
public static final String getFileExtension(File file) { String name = file.getName(); try {//from ww w . ja v a2s.com return name.substring(name.lastIndexOf(".") + 1); } catch (Exception e) { return ""; } }
From source file:SmartlingApiExample.java
private static String getFileUri(File file) { return file.getName(); }
From source file:Main.java
public static String getFileExtension(File file) { String name = file.getName(); int lastIndexOf = name.lastIndexOf("."); if (lastIndexOf == -1) { return ""; // empty extension }/*from w w w .java 2 s . c om*/ return name.substring(lastIndexOf); }
From source file:Main.java
public static String filenamefromPath(String path) { Uri u = Uri.parse(path);//from w w w . ja v a2 s.c o m File f = new File("" + u); return f.getName(); }
From source file:Main.java
public static void printFilePath(String pathname) { File f = new File(pathname); System.out.println("File Name: " + f.getName()); System.out.println("File exists: " + f.exists()); System.out.println("Absolute Path: " + f.getAbsolutePath()); try {/*from w ww . j a va2 s. c o m*/ System.out.println("Canonical Path: " + f.getCanonicalPath()); } catch (IOException e) { e.printStackTrace(); } }
From source file:Main.java
public static boolean isASFFile(File f) { return isASFFile(f.getName()); }
From source file:Main.java
public static void deleteFiles(String path, String name) { File sharedPrefsDir = new File(path); File[] files = sharedPrefsDir.listFiles(); for (File file : files) { if (file.getName().endsWith(name)) { file.delete();/*from ww w .ja va 2s .c om*/ } } }
From source file:Main.java
public static String getFileType(File file) { String fileName = file.getName(); int typeIndex = fileName.lastIndexOf("."); if (typeIndex != -1) { return fileName.substring(typeIndex + 1).toLowerCase(); } else {/*from w ww . j a v a2s . c om*/ return ""; } }
From source file:Main.java
public static String getFileNameFromPath(String fullPath) { File ffile = new File(fullPath); return ffile.getName(); }