Partager via


FileSystems.Default Property

Definition

Returns the default FileSystem.

public static Java.Nio.FileNio.FileSystem? Default { [Android.Runtime.Register("getDefault", "()Ljava/nio/file/FileSystem;", "", ApiSince=26)] get; }
[<get: Android.Runtime.Register("getDefault", "()Ljava/nio/file/FileSystem;", "", ApiSince=26)>]
static member Default : Java.Nio.FileNio.FileSystem

Property Value

the default file system

Attributes

Remarks

Returns the default FileSystem. The default file system creates objects that provide access to the file systems accessible to the Java virtual machine. The <em>working directory</em> of the file system is the current user directory, named by the system property user.dir. This allows for interoperability with the java.io.File java.io.File class.

The first invocation of any of the methods defined by this class locates the default FileSystemProvider provider object. Where the system property java.nio.file.spi.DefaultFileSystemProvider is not defined then the default provider is a system-default provider that is invoked to create the default file system.

If the system property java.nio.file.spi.DefaultFileSystemProvider is defined then it is taken to be a list of one or more fully-qualified names of concrete provider classes identified by the URI scheme "file". Where the property is a list of more than one name then the names are separated by a comma. Each class is loaded, using the system class loader, and instantiated by invoking a one argument constructor whose formal parameter type is FileSystemProvider. The providers are loaded and instantiated in the order they are listed in the property. If this process fails or a provider's scheme is not equal to "file" then an unspecified error is thrown. URI schemes are normally compared without regard to case but for the default provider, the scheme is required to be "file". The first provider class is instantiated by invoking it with a reference to the system-default provider. The second provider class is instantiated by invoking it with a reference to the first provider instance. The third provider class is instantiated by invoking it with a reference to the second instance, and so on. The last provider to be instantiated becomes the default provider; its getFileSystem method is invoked with the URI "file:///" to get a reference to the default file system.

Subsequent invocations of this method return the file system that was returned by the first invocation.

Java documentation for java.nio.file.FileSystems.getDefault().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to