|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectmars.util.FilenameFinder
public class FilenameFinder
Utility class to perform necessary file-related search operations. One is to find file names in JAR file, another is to find names of files in given directory of normal file system.
Field Summary | |
---|---|
static String |
MATCH_ALL_EXTENSIONS
|
Constructor Summary | |
---|---|
FilenameFinder()
|
Method Summary | |
---|---|
static boolean |
fileExtensionMatch(String name,
String extension)
Determine if given filename ends with given extension. |
static String |
getExtension(File file)
Get the filename extension of the specified File. |
static FileFilter |
getFileFilter(ArrayList extensions,
String description)
Get a FileFilter that will filter files based on the given list of filename extensions. |
static FileFilter |
getFileFilter(ArrayList extensions,
String description,
boolean acceptDirectories)
Get a FileFilter that will filter files based on the given list of filename extensions. |
static FileFilter |
getFileFilter(String extension,
String description)
Get a FileFilter that will filter files based on the given filename extension. |
static FileFilter |
getFileFilter(String extension,
String description,
boolean acceptDirectories)
Get a FileFilter that will filter files based on the given filename extension. |
static ArrayList |
getFilenameList(ArrayList nameList,
ArrayList fileExtensions)
Return list of file names. |
static ArrayList |
getFilenameList(ArrayList nameList,
String fileExtension)
Return list of file names. |
static ArrayList |
getFilenameList(ClassLoader classLoader,
String directoryPath,
ArrayList fileExtensions)
Locate files and return list of file names. |
static ArrayList |
getFilenameList(ClassLoader classLoader,
String directoryPath,
String fileExtension)
Locate files and return list of file names. |
static ArrayList |
getFilenameList(String directoryPath,
ArrayList fileExtensions)
Locate files and return list of file names. |
static ArrayList |
getFilenameList(String directoryPath,
String fileExtension)
Locate files and return list of file names. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static String MATCH_ALL_EXTENSIONS
Constructor Detail |
---|
public FilenameFinder()
Method Detail |
---|
public static ArrayList getFilenameList(ClassLoader classLoader, String directoryPath, String fileExtension)
classLoader
- class loader to usedirectoryPath
- Search will be confined to this directory. Use "/" as
separator but do NOT include starting or ending "/" (e.g. mars/tools)fileExtension
- Only files with this extension will be added
to the list. Do NOT include the "." in extension.
public static ArrayList getFilenameList(ClassLoader classLoader, String directoryPath, ArrayList fileExtensions)
classLoader
- class loader to usedirectoryPath
- Search will be confined to this directory. Use "/" as
separator but do NOT include starting or ending "/" (e.g. mars/tools)fileExtensions
- ArrayList of Strings containing file extensions.
Only files with an extension in this list will be added to the list.
Do NOT include the ".", eg "class" not ".class". If Arraylist or
extension null or empty, all files are added.
public static ArrayList getFilenameList(String directoryPath, String fileExtension)
directoryPath
- Search will be confined to this directory.fileExtension
- Only files with this extension will be added to the list.
Do NOT include "." in extension.
If null or empty string, all files are added.
public static ArrayList getFilenameList(String directoryPath, ArrayList fileExtensions)
directoryPath
- Search will be confined to this directory.fileExtensions
- ArrayList of Strings containing file extensions.
Only files with an extension in this list will be added
to the list. Do NOT include the "." in extensions. If Arraylist or
extension null or empty, all files are added.
public static ArrayList getFilenameList(ArrayList nameList, String fileExtension)
nameList
- ArrayList of String containing file names.fileExtension
- Only files with this extension will be added to the list.
If null or empty string, all files are added. Do NOT include "." in extension.
public static ArrayList getFilenameList(ArrayList nameList, ArrayList fileExtensions)
nameList
- ArrayList of String containing file names.fileExtensions
- ArrayList of Strings containing file extensions.
Only files with an extension in this list will be added
to the list. Do NOT include the "." in extensions. If Arraylist or
extension null or empty, all files are added.
public static String getExtension(File file)
file
- the File object representing the file of interest
public static FileFilter getFileFilter(ArrayList extensions, String description, boolean acceptDirectories)
extensions
- ArrayList of Strings, each string is acceptable filename extension.description
- String containing description to be added in parentheses after list of extensions.acceptDirectories
- boolean value true if directories are accepted by the filter, false otherwise.
public static FileFilter getFileFilter(ArrayList extensions, String description)
extensions
- ArrayList of Strings, each string is acceptable filename extensiondescription
- String containing description to be added in parentheses after list of extensions.
public static FileFilter getFileFilter(String extension, String description, boolean acceptDirectories)
extension
- String containing acceptable filename extension.description
- String containing description to be added in parentheses after list of extensions.acceptDirectories
- boolean value true if directories are accepted by the filter, false otherwise.
public static FileFilter getFileFilter(String extension, String description)
extension
- String containing acceptable filename extensiondescription
- String containing description to be added in parentheses after list of extensions.
public static boolean fileExtensionMatch(String name, String extension)
name
- A String containing the file nameextension
- A String containing the file extension. Leading period is optional.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |