Public Types | |
| OPEN | |
| enum | FileChooserType { OPEN, SAVE } |
| Either show a save or open dialog. | |
Static Public Member Functions | |
| static void | copy (File srcFileOrDir, File targetFileOrDir) |
| static void | copy (File sourceFileOrDir, File targetFileOrDir, boolean visibleFilesOnly) throws IOException |
| A flexible copy function. | |
| static JFileChooser | createNewFileChooser (String[] extensions) |
| static void | downloadUrlToFile (URL url, File result) throws IOException |
| static String | getCurrentTimeForUseInAFileName () |
| static String | getCurrentTimeForUseInASortableFileName () |
| static boolean | isHiddenOrDotFile (final File possiblyHiddenFile) |
| static List< File > | listVisibleDirs (File path) |
| Return only directories (that are children of the given path) that are not hidden. | |
| static List< File > | listVisibleFiles (File path, String...extensionFilter) |
| Return only files (that are children of the given path) that are not hidden. | |
| static List< File > | listVisibleFilesRecursively (File path) |
| static List< File > | listVisibleFilesRecursively (File path, String[] extensionFilter) |
| static StringBuilder | readFileIntoStringBuffer (File f) |
| Reads an entire file into the StringBuilder (faster than StringBuffer). | |
| static StringBuilder | readFileIntoStringBuffer (File f, boolean separateWithNewLines) |
| Includes the workaround for bug in setting the user.dir: http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4117557. | |
| static File | showDirectoryChooser (Component parent, String title) |
| Only allows directory selection. | |
| static File | showFileChooser (File initialPath, FileChooserType type, Component parent, String[] extensions, String title) |
| static void | sortByLastModified (List< File > files, final SortDirection direction) |
| static void | sortPhotosByCaptureDate (List< File > files, final SortDirection direction) |
| For JPEGs. | |
| static void | writeStringToFile (String string, File destFile) |
| Includes workaround for bug: http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4117557. | |
| static void | writeStringToFileOnlyIfNew (String string, File file) |
This software is distributed under the BSD License.
Definition at line 49 of file FileUtils.java.
| static void copy | ( | File | sourceFileOrDir, | |
| File | targetFileOrDir, | |||
| boolean | visibleFilesOnly | |||
| ) | throws IOException [static] |
A flexible copy function.
It will do slightly different things depending on what is passed into the parameters. It can copy a file to another file, into a directory, or a directory into another directory.
| sourceFileOrDir | ||
| targetFileOrDir | ||
| b |
| IOException |
Definition at line 83 of file FileUtils.java.
| static JFileChooser createNewFileChooser | ( | String[] | extensions | ) | [static] |
| extensions | should NOT have a . in front of them... i.e., xml, and NOT .xml |
Definition at line 189 of file FileUtils.java.
Referenced by FileUtils.showFileChooser().
| static void downloadUrlToFile | ( | URL | url, | |
| File | result | |||
| ) | throws IOException [static] |
| static String getCurrentTimeForUseInAFileName | ( | ) | [static] |
Definition at line 241 of file FileUtils.java.
| static String getCurrentTimeForUseInASortableFileName | ( | ) | [static] |
| static boolean isHiddenOrDotFile | ( | final File | possiblyHiddenFile | ) | [static] |
| possiblyHiddenFile |
Definition at line 276 of file FileUtils.java.
| static List<File> listVisibleDirs | ( | File | path | ) | [static] |
Return only directories (that are children of the given path) that are not hidden.
| path |
Definition at line 286 of file FileUtils.java.
| static List<File> listVisibleFiles | ( | File | path, | |
| String... | extensionFilter | |||
| ) | [static] |
Return only files (that are children of the given path) that are not hidden.
TODO/BUG: Doesn't use FileExcludeHiddenFilter??
| path | ||
| extensionFilter |
Definition at line 299 of file FileUtils.java.
| static List<File> listVisibleFilesRecursively | ( | File | path, | |
| String[] | extensionFilter | |||
| ) | [static] |
| path | ||
| extensionFilter |
Definition at line 341 of file FileUtils.java.
| static List<File> listVisibleFilesRecursively | ( | File | path | ) | [static] |
| static StringBuilder readFileIntoStringBuffer | ( | File | f, | |
| boolean | separateWithNewLines | |||
| ) | [static] |
Includes the workaround for bug in setting the user.dir: http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4117557.
| f | turn this file into a big string buffer (StringBuilder for efficiency) | |
| separateWithNewLines |
Definition at line 399 of file FileUtils.java.
| static StringBuilder readFileIntoStringBuffer | ( | File | f | ) | [static] |
Reads an entire file into the StringBuilder (faster than StringBuffer).
| f |
Definition at line 386 of file FileUtils.java.
| static File showDirectoryChooser | ( | Component | parent, | |
| String | title | |||
| ) | [static] |
Only allows directory selection.
Definition at line 428 of file FileUtils.java.
| static File showFileChooser | ( | File | initialPath, | |
| FileChooserType | type, | |||
| Component | parent, | |||
| String[] | extensions, | |||
| String | title | |||
| ) | [static] |
| initialPath | ||
| type | ||
| parent | ||
| extensions | ||
| title |
Definition at line 452 of file FileUtils.java.
References FileUtils.createNewFileChooser().
| static void sortByLastModified | ( | List< File > | files, | |
| final SortDirection | direction | |||
| ) | [static] |
| static void sortPhotosByCaptureDate | ( | List< File > | files, | |
| final SortDirection | direction | |||
| ) | [static] |
For JPEGs.
...
This is a little bit slow, as it takes 4.3 seconds for about 670 files. Can we speed this up through a cache? After implementing the cache, it takes about 875 ms to sort 670 files. This is because we only read each file once, and save the timestamp in memory.
| files | ||
| direction |
Definition at line 519 of file FileUtils.java.
| static void writeStringToFile | ( | String | string, | |
| File | destFile | |||
| ) | [static] |
Includes workaround for bug: http://bugs.sun.com/bugdatabase/view_bug.do;:YfiG?bug_id=4117557.
| string | ||
| destFile | Jun 5, 2006 |
Definition at line 576 of file FileUtils.java.
Referenced by FileUtils.writeStringToFileOnlyIfNew().
| static void writeStringToFileOnlyIfNew | ( | String | string, | |
| File | file | |||
| ) | [static] |
| string | ||
| file | Mar 14, 2006 |
Definition at line 598 of file FileUtils.java.
References FileUtils.writeStringToFile().
1.4.7