There are lots of examples on the net about creating Java NIO Filesystem instances using code like this
Map<String, String> env = new HashMap<String, String>();
env.put("create", "true");
FileSystem zipfs = FileSystems.newFileSystem(zipUri, env);
But what are the supported options that can be placed within the "env" map? And what are they good for?
The Javadoc for FileSystem.newFileSystem(URI uri, Map<String,?> env)
specifies
env - a map of provider specific properties to configure the file system; may be empty
So these depend on the type of provider that will create the new FileSystem
for the given uri
.
In your example, you've provided a URI
presumably representing a ZIP file. This is served by a Zip File System Provider whose properties are defined here. Those are
"create"
: true
/ false
The value should be of type
java.lang.String
. The default value isfalse
. If the value istrue
, the zip file system provider creates a new zip file if it does not exist.
"encoding"
: String
indicating the encoding scheme
The value should be of type
java.lang.String
. The value of the property indicates the encoding scheme for the names of the entries in the zip or JAR file. The default value is UTF-8.