FileSystemProvider is a Service-provider class for file
systems.
This is an abstract class. All the concrete file system
provider implementations must implement the abstract methods of this class.
A provider is identified by the scheme. Below snippet
return all the filesystem providers that are installed in your system.
package com.sample.app; import java.io.IOException; import java.nio.file.spi.FileSystemProvider; import java.util.List; public class App { public static void main(String args[]) throws IOException { List<FileSystemProvider> fileSystemProviders = FileSystemProvider.installedProviders(); for (FileSystemProvider fileSystemProvider : fileSystemProviders) { System.out.println(fileSystemProvider.getScheme()); } } }
Output
file
jar
No comments:
Post a Comment