List of utility methods to do File Name Get
String[] | getFileNameArrayFromDirectory(String directoryLocation) get File Name Array From Directory String[] children = null; try { File dir = new File(directoryLocation); children = dir.list(); if (children == null) { children = new String[0]; } catch (Exception e) { ... |
FilenameFilter | getFileNameFilter(final String endsWith) Erstellt einen Dateienamenfilter fuer Dateiendungen return new FilenameFilter() { public boolean accept(File directory, String fileName) { if (endsWith == null) return true; return fileName.toLowerCase().endsWith(endsWith.toLowerCase()); }; |
FilenameFilter | getFilenameFilter(final String extension) get Filename Filter return new FilenameFilter() { @Override public boolean accept(File file, String name) { return file.isFile() && name.endsWith(extension); }; |
FilenameFilter | getFilenameFilter(final String pFilter, final boolean pExclude) Returns the file filter object. return getFilenameFilter(pFilter, pExclude, false);
|
String | getFilenameForClassName(String className) get Filename For Class Name return className.replace('.', File.separatorChar) + JavaFileObject.Kind.CLASS.extension; |
String | getFileNameFromCanonical(String file) get File Name From Canonical if (file == null) return null; int n = file.lastIndexOf("."); if (n != -1) file = file.substring(0, n); n = file.lastIndexOf(File.separator); if (n != -1) file = file.substring(n + 1, file.length()); ... |
String | getFileNameFromFilePath(String filepath) get the filename from filepath eg D:\\R4.2chm --> R4.2chm boolean c = filepath.lastIndexOf("/") == -1 ? false : true; if (c) { filepath = filepath.substring(filepath.lastIndexOf("/") + 1); } else { filepath = filepath.substring(filepath.lastIndexOf(File.separator) + 1); return filepath; |
String | getFileNameFromFilePath(String filePath) get File Name From File Path String fileName = filePath.substring(filePath.lastIndexOf(File.separator) + File.separator.length());
return fileName;
|
String | getFileNameFromFullPath(String fullPath) Extracts the filename from the full file path. return new File(fullPath).getName(); |
String | getFileNameFromZipEntry(ZipEntry entry) get File Name From Zip Entry String fileName = entry.getName(); int idx; if ((idx = fileName.lastIndexOf("/")) > -1 || (idx = fileName.lastIndexOf(File.separator)) > -1) { fileName = fileName.substring(idx + 1); return fileName; |