You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As a user writing a suite of unit tests against a file-IO heavy application, I would like to simply set the default file system provider via a call similar to System.setProperty("java.nio.file.spi.DefaultFileSystemProvider", "com.google.common.jimfs.SystemJimfsFileSystemProvider"), so that I can more easily apply JimFS as the systems file system.
So this is hopefully a fairly minor request:
the system property "java.nio.file.spi.DefaultFileSystemProvider" controls which FileSystemProvider is to be used as the default one. It works by specifying a fully-qualified class name as the value, which will be loaded on a call to java.nio.file.FileSystems.DefaultFileSystemHolder#getDefaultProvider. It does this by looking for a constructor that takes a FileSystemProvider as its single argument, effectively allowing you to chain-wrap file system providers.
So, if you guys could add another constructor to the SystemFileSystemProvider, that takes a provider as an argument and simply ignores it, I would be much appreciative.
Regarding
I'd strongly recommend not using Paths.get to get a Path in your production code. It's convenient as a quick replacement for new File(String) when migrating from the old API, but that's about it. When using java.nio.file, methods that tie you to the default FileSystem are generally an anti-pattern.
I agree with the general principal but I'd appreciate a little trust in navigating this space myself. I think this is better expressed as a line in documentation rather than a hard requirement within your library.
In my particular case, some of my libraries are calling Paths.get() and the application I'm building is quite small, so I'm OK with using statics for testing here.
So this is hopefully a fairly minor request:
the system property "java.nio.file.spi.DefaultFileSystemProvider" controls which FileSystemProvider is to be used as the default one. It works by specifying a fully-qualified class name as the value, which will be loaded on a call to
java.nio.file.FileSystems.DefaultFileSystemHolder#getDefaultProvider
. It does this by looking for a constructor that takes aFileSystemProvider
as its single argument, effectively allowing you to chain-wrap file system providers.So, if you guys could add another constructor to the
SystemFileSystemProvider
, that takes a provider as an argument and simply ignores it, I would be much appreciative.Regarding
I agree with the general principal but I'd appreciate a little trust in navigating this space myself. I think this is better expressed as a line in documentation rather than a hard requirement within your library.
In my particular case, some of my libraries are calling
Paths.get()
and the application I'm building is quite small, so I'm OK with using statics for testing here.This issue relates to:
The text was updated successfully, but these errors were encountered: