public static FileSystem newFileSystem (URI uri, Map<String, ?> env) throws IOException

Constructs a new file system that is identified by a URI

This method iterates over the FileSystemProvider.installedProviders() providers to locate the provider that is identified by the URI 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) method is invoked to construct the new file system.

Once a file system is 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.

Usage Example: Suppose there is a provider identified by the scheme "memory" installed:

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

Parameters:
uri     the URI identifying the file system
env     a map of provider specific properties to configure the file system; may be empty

Returns:  a new file system

Exceptions:
IllegalArgumentException     if the pre-conditions for the uri parameter are not met, or the env parameter does not contain properties required by the provider, or a property value is invalid
FileSystemAlreadyExistsException     if the file system has already been created
ProviderNotFoundException     if a provider supporting the URI scheme is not installed
IOException     if an I/O error occurs creating the file system
SecurityException     if a security manager is installed and it denies an unspecified permission required by the file system provider implementation