Sunday 16 June 2019

FileSystemProvider: getScheme: Get the scheme that identifies this provider


'getScheme' method returns the URI scheme that identifies this provider.

App.java
package com.sample.app;

import java.io.IOException;
import java.nio.file.FileSystem;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.spi.FileSystemProvider;

public class App {

    public static void main(String args[]) throws IOException {

        Path path = Paths.get("/Users/krishna/documents");
        FileSystem fileSystem = path.getFileSystem();
        FileSystemProvider fileSystemProvider = fileSystem.provider();
        
        System.out.println("Scheme : " + fileSystemProvider.getScheme());

    }
}

Output
Scheme : file



Previous                                                 Next                                                 Home

No comments:

Post a Comment