Freigeben über


FileSystems.GetFileSystem(URI) Method

Definition

Returns a reference to an existing FileSystem.

[Android.Runtime.Register("getFileSystem", "(Ljava/net/URI;)Ljava/nio/file/FileSystem;", "", ApiSince=26)]
public static Java.Nio.FileNio.FileSystem? GetFileSystem (Java.Net.URI? uri);
[<Android.Runtime.Register("getFileSystem", "(Ljava/net/URI;)Ljava/nio/file/FileSystem;", "", ApiSince=26)>]
static member GetFileSystem : Java.Net.URI -> Java.Nio.FileNio.FileSystem

Parameters

uri
URI

the URI to locate the file system

Returns

the reference to the file system

Attributes

Remarks

Returns a reference to an existing FileSystem.

This method iterates over the FileSystemProvider#installedProviders() installed providers to locate the provider that is identified by the URI URI#getScheme scheme of the given URI. URI schemes are compared without regard to case. The exact form of the URI is highly provider dependent. If found, the provider's FileSystemProvider#getFileSystem getFileSystem method is invoked to obtain a reference to the FileSystem.

Once a file system created by this provider is FileSystem#close closed it is provider-dependent if this method returns a reference to the closed file system or throws FileSystemNotFoundException. If the provider allows a new file system to be created with the same URI as a file system it previously created then this method throws the exception if invoked after the file system is closed (and before a new instance is created by the #newFileSystem newFileSystem method).

If a security manager is installed then a provider implementation may require to check a permission before returning a reference to an existing file system. In the case of the FileSystems#getDefault default file system, no permission check is required.

Java documentation for java.nio.file.FileSystems.getFileSystem(java.net.URI).

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