Partager via


FileSystems.NewFileSystem Method

Definition

Overloads

NewFileSystem(URI, IDictionary<String,Object>)

Constructs a new file system that is identified by a URI

NewFileSystem(IPath, ClassLoader)

Constructs a new FileSystem to access the contents of a file as a file system.

NewFileSystem(URI, IDictionary<String,Object>, ClassLoader)

Constructs a new file system that is identified by a URI

NewFileSystem(URI, IDictionary<String,Object>)

Constructs a new file system that is identified by a URI

[Android.Runtime.Register("newFileSystem", "(Ljava/net/URI;Ljava/util/Map;)Ljava/nio/file/FileSystem;", "", ApiSince=26)]
public static Java.Nio.FileNio.FileSystem? NewFileSystem (Java.Net.URI? uri, System.Collections.Generic.IDictionary<string,object>? env);
[<Android.Runtime.Register("newFileSystem", "(Ljava/net/URI;Ljava/util/Map;)Ljava/nio/file/FileSystem;", "", ApiSince=26)>]
static member NewFileSystem : Java.Net.URI * System.Collections.Generic.IDictionary<string, obj> -> Java.Nio.FileNio.FileSystem

Parameters

uri
URI

the URI identifying the file system

env
IDictionary<String,Object>

a map of provider specific properties to configure the file system; may be empty

Returns

a new file system

Attributes

Remarks

Constructs a new file system that is identified by a URI

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#newFileSystem(URI,Map) newFileSystem(URI,Map) method is invoked to construct the new file system.

Once a file system is FileSystem#close closed it is provider-dependent if the provider allows a new file system to be created with the same URI as a file system it previously created.

<b>Usage Example:</b> Suppose there is a provider identified by the scheme "memory" installed:

Map&lt;String,String&gt; env = new HashMap&lt;&gt;();
              env.put("capacity", "16G");
              env.put("blockSize", "4k");
              FileSystem fs = FileSystems.newFileSystem(URI.create("memory:///?name=logfs"), env);

Java documentation for java.nio.file.FileSystems.newFileSystem(java.net.URI, java.util.Map<java.lang.String, ?>).

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

NewFileSystem(IPath, ClassLoader)

Constructs a new FileSystem to access the contents of a file as a file system.

[Android.Runtime.Register("newFileSystem", "(Ljava/nio/file/Path;Ljava/lang/ClassLoader;)Ljava/nio/file/FileSystem;", "", ApiSince=26)]
public static Java.Nio.FileNio.FileSystem? NewFileSystem (Java.Nio.FileNio.IPath? path, Java.Lang.ClassLoader? loader);
[<Android.Runtime.Register("newFileSystem", "(Ljava/nio/file/Path;Ljava/lang/ClassLoader;)Ljava/nio/file/FileSystem;", "", ApiSince=26)>]
static member NewFileSystem : Java.Nio.FileNio.IPath * Java.Lang.ClassLoader -> Java.Nio.FileNio.FileSystem

Parameters

path
IPath

the path to the file

loader
ClassLoader

the class loader to locate the provider or null to only attempt to locate an installed provider

Returns

a new file system

Attributes

Remarks

Constructs a new FileSystem to access the contents of a file as a file system.

This method makes use of specialized providers that create pseudo file systems where the contents of one or more files is treated as a file system.

This method iterates over the FileSystemProvider#installedProviders() installed providers. It invokes, in turn, each provider's FileSystemProvider#newFileSystem(Path,Map) newFileSystem(Path,Map) method with an empty map. If a provider returns a file system then the iteration terminates and the file system is returned. If none of the installed providers return a FileSystem then an attempt is made to locate the provider using the given class loader. If a provider returns a file system then the lookup terminates and the file system is returned.

Java documentation for java.nio.file.FileSystems.newFileSystem(java.nio.file.Path, java.lang.ClassLoader).

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

NewFileSystem(URI, IDictionary<String,Object>, ClassLoader)

Constructs a new file system that is identified by a URI

[Android.Runtime.Register("newFileSystem", "(Ljava/net/URI;Ljava/util/Map;Ljava/lang/ClassLoader;)Ljava/nio/file/FileSystem;", "", ApiSince=26)]
public static Java.Nio.FileNio.FileSystem? NewFileSystem (Java.Net.URI? uri, System.Collections.Generic.IDictionary<string,object>? env, Java.Lang.ClassLoader? loader);
[<Android.Runtime.Register("newFileSystem", "(Ljava/net/URI;Ljava/util/Map;Ljava/lang/ClassLoader;)Ljava/nio/file/FileSystem;", "", ApiSince=26)>]
static member NewFileSystem : Java.Net.URI * System.Collections.Generic.IDictionary<string, obj> * Java.Lang.ClassLoader -> Java.Nio.FileNio.FileSystem

Parameters

uri
URI

the URI identifying the file system

env
IDictionary<String,Object>

a map of provider specific properties to configure the file system; may be empty

loader
ClassLoader

the class loader to locate the provider or null to only attempt to locate an installed provider

Returns

a new file system

Attributes

Remarks

Constructs a new file system that is identified by a URI

This method first attempts to locate an installed provider in exactly the same manner as the #newFileSystem(URI,Map) newFileSystem(URI,Map) method. If none of the installed providers support the URI scheme then an attempt is made to locate the provider using the given class loader. If a provider supporting the URI scheme is located then its FileSystemProvider#newFileSystem(URI,Map) newFileSystem(URI,Map) is invoked to construct the new file system.

Java documentation for java.nio.file.FileSystems.newFileSystem(java.net.URI, java.util.Map<java.lang.String, ?>, java.lang.ClassLoader).

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