com.holub.io
Class Files
java.lang.Object
com.holub.io.Files
public class Files
- extends Object
A utility that handles various File-related operations.
Constructor Summary |
Files()
|
Files
public Files()
userSelected
public static File userSelected(String startHere,
String extension,
String description,
String selectButtonText)
throws FileNotFoundException
- Throw up a file choser and return the file that the user selects.
- Parameters:
extension
- File extension (text following the rightmost
dot in the name) that you're looking for.
Use null if any will do.description
- the description of what the extension means.
Not used if "extension" is null.selectButtonText
- Replaces the "Open" on the chooser button.startHere
- Name of initial directory in which to look.
- Returns:
- a
File
representing the selected file.
- Throws:
FileNotFoundException
- if the user didn't select a file.
An exception toss (as compared to a null return value)
makes it easy to do the following:
FileInputStream in =
new FileInputStream(
Files.userSelected(".",".txt","Text File","Open"));