|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.fife.ui.rtextfilechooser.Utilities
public class Utilities
Utility classes for dealing with an RTextFileChooser
.
RTextFileChooser
Constructor Summary | |
---|---|
Utilities()
|
Method Summary | |
---|---|
static boolean |
addFileFilters(java.io.File file,
RTextFileChooser chooser)
Adds user-defined file filters to a file chooser, as specified in a file. |
static void |
copyFile(java.io.File sourceFile,
java.io.File destFile)
Copies a file from one location to another. |
static java.lang.String |
getExtension(java.lang.String fileName)
Returns the extension of a file name. |
static java.lang.String |
getFileSizeStringFor(java.io.File file)
Returns a string representation of a file size, such as "842 bytes", "1.43 KB" or "3.4 MB". |
static java.lang.String |
getFileSizeStringFor(long size,
boolean reportInKB)
Returns a string representation of a file size, such as "842 bytes", "1.43 KB" or "3.4 MB". |
static java.lang.String |
getLastModifiedString(long date)
Returns a date string for the file's "last modified" time. |
static boolean |
isCaseSensitiveFileSystem()
Returns whether or not the current OS is case-sensitive. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Utilities()
Method Detail |
---|
public static boolean addFileFilters(java.io.File file, RTextFileChooser chooser) throws java.io.IOException
The file should have the following format:
<?xml version="1.0"?> <ExtraFileFilters> <ExtensionFileFilter name="filter-name" ignoreCase="true|false" showExtensions="true|false"> <Extension>ext-with-no-dot</Extension> ... </ExtensionFileFilter> </ExtraFileFilters>where
filter-name
is the description of the filter as
displayed in the file chooser, ignoreCase
designates
whether the filter should ignore case when filtering files, and
showExtensions
designates whether the extensions should
be displayed beside the description in the file chooser.
The values within Extension
tags are the extensions of
files to be accepted by the filter (excluding the initial period).
ignoreCase
and showExtensions
both have a
default value of true
.
file
- The XML file, as described above.chooser
- The file chooser to which to add the file filters.
java.io.IOException
- If an I/O error occurs while reading the file.public static void copyFile(java.io.File sourceFile, java.io.File destFile) throws java.io.IOException
sourceFile
- The file to copy.destFile
- The location for the new copy.
java.io.IOException
- If an error occurs.public static final java.lang.String getExtension(java.lang.String fileName)
fileName
- The file name.
null
if the file name has no
extension.public static final java.lang.String getFileSizeStringFor(java.io.File file)
file
- The file for which you want its size converted into an
appropriate string.
file
is a directory.public static final java.lang.String getFileSizeStringFor(long size, boolean reportInKB)
size
- the size of a file, in bytes.
getFileSizeStringFor(File)
public static final java.lang.String getLastModifiedString(long date)
date
- The date, as a long
.
public static final boolean isCaseSensitiveFileSystem()
false
, other OSes will return
true
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |