Here you can find the source of getPath(FileSystem targetFS, String fileName)
public static Path getPath(FileSystem targetFS, String fileName)
//package com.java2s; //License from project: Open Source License import java.nio.file.FileSystem; import java.nio.file.Path; import java.util.Arrays; public class Main { public static Path getPath(FileSystem targetFS, String fileName) { String[] nameComps = fileName.replace('\\', '/').split("/"); if (nameComps.length == 1) { return targetFS.getPath(nameComps[0]); } else {//from w ww.j a va2s. c o m return targetFS.getPath(nameComps[0], Arrays.copyOfRange(nameComps, 1, nameComps.length)); } } }