public abstract class FileSystemView extends Object
Java Licensees may want to provide a different implementation of FileSystemView to better handle a given operating system.
| Constructor | Description |
|---|---|
FileSystemView() |
Constructs a FileSystemView.
|
| Modifier and Type | Method | Description |
|---|---|---|
File |
createFileObject(File dir,
String filename) |
Returns a File object constructed in dir from the given filename.
|
File |
createFileObject(String path) |
Returns a File object constructed from the given path string.
|
protected File |
createFileSystemRoot(File f) |
Creates a new
File object for f with correct
behavior for a file system root directory. |
abstract File |
createNewFolder(File containingDir) |
Creates a new folder with a default folder name.
|
File |
getChild(File parent,
String fileName) |
|
File[] |
getChooserComboBoxFiles() |
Returns an array of files representing the values to show by default in
the file chooser selector.
|
File |
getDefaultDirectory() |
Return the user's default starting directory for the file chooser.
|
File[] |
getFiles(File dir,
boolean useFileHiding) |
Gets the list of shown (i.e. not hidden) files.
|
static FileSystemView |
getFileSystemView() |
Returns the file system view.
|
File |
getHomeDirectory() |
Returns the home directory.
|
File |
getLinkLocation(File file) |
Returns the regular file referenced by the specified link file if
the specified file is a shell interpreted link.
|
File |
getParentDirectory(File dir) |
Returns the parent directory of
dir. |
File[] |
getRoots() |
Returns all root partitions on this system.
|
String |
getSystemDisplayName(File f) |
Name of a file, directory, or folder as it would be displayed in
a system file browser.
|
Icon |
getSystemIcon(File f) |
Icon for a file, directory, or folder as it would be displayed in
a system file browser.
|
String |
getSystemTypeDescription(File f) |
Type description for a file, directory, or folder as it would be displayed in
a system file browser.
|
boolean |
isComputerNode(File dir) |
Used by UI classes to decide whether to display a special icon
for a computer node, e.g.
|
boolean |
isDrive(File dir) |
Used by UI classes to decide whether to display a special icon
for drives or partitions, e.g. a "hard disk" icon.
|
boolean |
isFileSystem(File f) |
Checks if
f represents a real directory or file as opposed to a
special folder such as "Desktop". |
boolean |
isFileSystemRoot(File dir) |
Is dir the root of a tree in the file system, such as a drive
or partition.
|
boolean |
isFloppyDrive(File dir) |
Used by UI classes to decide whether to display a special icon
for a floppy disk.
|
boolean |
isHiddenFile(File f) |
Returns whether a file is hidden or not.
|
boolean |
isLink(File file) |
Returns whether the specified file denotes a shell interpreted link which
can be obtained by the
getLinkLocation(File). |
boolean |
isParent(File folder,
File file) |
On Windows, a file can appear in multiple folders, other than its
parent directory in the filesystem.
|
boolean |
isRoot(File f) |
Determines if the given file is a root in the navigable tree(s).
|
Boolean |
isTraversable(File f) |
Returns true if the file (directory) can be visited.
|
public static FileSystemView getFileSystemView()
public boolean isRoot(File f)
C:\, D:\, etc. Unix has one root,
the "/" directory.
The default implementation gets information from the ShellFolder class.f - a File object representing a directorytrue if f is a root in the navigable tree.isFileSystemRoot(java.io.File)public Boolean isTraversable(File f)
f - the Filetrue if the file/directory can be traversed, otherwise falseJFileChooser.isTraversable(java.io.File),
FileView.isTraversable(java.io.File)public String getSystemDisplayName(File f)
f - a File objectJFileChooser.getName(java.io.File)public String getSystemTypeDescription(File f)
f - a File objectJFileChooser.getTypeDescription(java.io.File)public Icon getSystemIcon(File f)
f - a File objectJFileChooser.getIcon(java.io.File)public boolean isParent(File folder, File file)
folder - a File object representing a directory or special folderfile - a File objecttrue if folder is a directory or special folder and contains file.public File getChild(File parent, String fileName)
parent - a File object representing a directory or special folderfileName - a name of a file or folder which exists in parentnew
File(parent, fileName) except when parent and child are both
special folders, in which case the File is a wrapper containing
a ShellFolder object.public boolean isFileSystem(File f)
f represents a real directory or file as opposed to a
special folder such as "Desktop". Used by UI classes to decide if
a folder is selectable when doing directory choosing.f - a File objecttrue if f is a real file or directory.public abstract File createNewFolder(File containingDir) throws IOException
containingDir - a File object denoting directory to contain the new folderFile object denoting the newly created folderIOException - if new folder could not be createdpublic boolean isHiddenFile(File f)
f - a File objectFile denotes a hidden filepublic boolean isFileSystemRoot(File dir)
dir - a File object representing a directorytrue if f is a root of a filesystemisRoot(java.io.File)public boolean isDrive(File dir)
dir - a directoryfalse alwayspublic boolean isFloppyDrive(File dir)
dir - a directoryfalse alwayspublic boolean isComputerNode(File dir)
dir - a directoryfalse alwayspublic File[] getRoots()
File objects representing all root partitions
on this systempublic File getHomeDirectory()
public File getDefaultDirectory()
File object representing the default
starting folderpublic File createFileObject(File dir, String filename)
dir - an abstract pathname denoting a directoryfilename - a String representation of a pathnameFile object created from dir and filenamepublic File createFileObject(String path)
path - String representation of pathFile object created from the given pathpublic File[] getFiles(File dir, boolean useFileHiding)
dir - the root directory of files to be returneduseFileHiding - determine if hidden files are returnedFile objects representing files and
directories in the given dir. It includes hidden
files if useFileHiding is false.public File getParentDirectory(File dir)
dir.dir - the File being querieddir, or
null if dir is nullpublic File[] getChooserComboBoxFiles()
File objects.SecurityException - if the caller does not have necessary
permissionspublic boolean isLink(File file)
getLinkLocation(File).file - a fileNullPointerException - if file equals nullSecurityException - if the caller does not have necessary
permissionsgetLinkLocation(File)public File getLinkLocation(File file) throws FileNotFoundException
null if the specified file is not
a shell interpreted link.file - a filenull.FileNotFoundException - if the linked file does not existNullPointerException - if file equals nullSecurityException - if the caller does not have necessary
permissionsprotected File createFileSystemRoot(File f)
File object for f with correct
behavior for a file system root directory.f - a File object representing a file system root
directory, for example "/" on Unix or "C:\" on Windows.File object Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.
DRAFT 9-Debian+0-9b155-1