Java File System getFileSystem(Path file)

Here you can find the source of getFileSystem(Path file)

Description

get File System

License

Open Source License

Declaration

public static FileSystem getFileSystem(Path file) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.nio.file.Path;
import java.nio.file.FileSystem;
import java.nio.file.FileSystems;

import java.io.IOException;
import java.util.HashMap;
import java.net.URI;

public class Main {
    public static FileSystem getFileSystem(Path file) throws IOException {
        FileSystem fs = null;//ww w.  j a  va  2s  .  co m
        try {
            URI fileUri = file.toUri();
            URI uri = new URI("jar:" + fileUri.getScheme(), fileUri.getPath(), null);
            fs = FileSystems.newFileSystem(uri, new HashMap<String, String>());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return fs;
    }
}

Related

  1. findFile(FileSystem fileSystem, String path, String optionalFileSuffix)
  2. getFileSystem(Path path)
  3. getPath(FileSystem targetFS, String fileName)
  4. isFileSystemAvailable(final Path file, final String topLevelAbsolutePath)
  5. isFileSystemAvailable2(final Path file, final String topLevelAbsolutePath)