@Test public void pathFromParts() { assertNull(FileUtil.pathFromParts()); assertNull(FileUtil.pathFromParts((String[]) null)); assertEquals("", FileUtil.pathFromParts("")); assertEquals("test", FileUtil.pathFromParts("test")); assertEquals("null", FileUtil.pathFromParts((String) null)); assertEquals("test" + File.separator + "again", FileUtil.pathFromParts("test", "again")); assertEquals("test" + File.separator + "again" + File.separator + "more", FileUtil.pathFromParts("test", "again", "more")); assertEquals("test" + File.separator + "again", FileUtil.pathFromParts("test" + File.separator, "again")); assertEquals("test" + File.separator + "again" + File.separator + "more" + File.separator, FileUtil.pathFromParts("test" + File.separator, "again" + File.separator, "more" + File.separator)); }
public static String pathFromParts(String ... parts) { if ((parts == null) || (parts.length < 1)) { return null; } StringBuilder buf = new StringBuilder(); for (String part : parts) { if ((buf.length() > 0) && (buf.charAt(buf.length() - 1) != File.separatorChar) && !part.startsWith(File.separator)) { buf.append(File.separatorChar); } buf.append(part); } return buf.toString(); }
FileUtil { public static String pathFromParts(String ... parts) { if ((parts == null) || (parts.length < 1)) { return null; } StringBuilder buf = new StringBuilder(); for (String part : parts) { if ((buf.length() > 0) && (buf.charAt(buf.length() - 1) != File.separatorChar) && !part.startsWith(File.separator)) { buf.append(File.separatorChar); } buf.append(part); } return buf.toString(); } }
FileUtil { public static String pathFromParts(String ... parts) { if ((parts == null) || (parts.length < 1)) { return null; } StringBuilder buf = new StringBuilder(); for (String part : parts) { if ((buf.length() > 0) && (buf.charAt(buf.length() - 1) != File.separatorChar) && !part.startsWith(File.separator)) { buf.append(File.separatorChar); } buf.append(part); } return buf.toString(); } private  FileUtil(); }
FileUtil { public static String pathFromParts(String ... parts) { if ((parts == null) || (parts.length < 1)) { return null; } StringBuilder buf = new StringBuilder(); for (String part : parts) { if ((buf.length() > 0) && (buf.charAt(buf.length() - 1) != File.separatorChar) && !part.startsWith(File.separator)) { buf.append(File.separatorChar); } buf.append(part); } return buf.toString(); } private  FileUtil(); static boolean copyDir(File fromDir, File toDir); static boolean copyDir(File fromDir, File toDir, FilenameFilter excluding); static boolean copy(File from, File to); static boolean copy(URL from, File to); static boolean copy(InputStream from, File to); static String getLocalPath(URL url, Map<String, String> headers, String name, String intoName); static boolean download(URL remoteUrl, Map<String, String> headers, File into, String name, String intoName, boolean ignoreFNF); static URL getUrl(String path); static InputStream downloadToStream(URL remoteUrl, Map<String, String> headers); static String pathFromParts(String ... parts); static File fromParts(String ... parts); static String resolveUnixTilde(String path); static String reverseUnixTilde(String path); static boolean isLocalPath(String path); static String encodeForURI(String filePath); static void delete(File file); static String getCanonicalPath(File file); static String stripFileUriPrefix(String path); static String getSha1Hash(File file); }
FileUtil { public static String pathFromParts(String ... parts) { if ((parts == null) || (parts.length < 1)) { return null; } StringBuilder buf = new StringBuilder(); for (String part : parts) { if ((buf.length() > 0) && (buf.charAt(buf.length() - 1) != File.separatorChar) && !part.startsWith(File.separator)) { buf.append(File.separatorChar); } buf.append(part); } return buf.toString(); } private  FileUtil(); static boolean copyDir(File fromDir, File toDir); static boolean copyDir(File fromDir, File toDir, FilenameFilter excluding); static boolean copy(File from, File to); static boolean copy(URL from, File to); static boolean copy(InputStream from, File to); static String getLocalPath(URL url, Map<String, String> headers, String name, String intoName); static boolean download(URL remoteUrl, Map<String, String> headers, File into, String name, String intoName, boolean ignoreFNF); static URL getUrl(String path); static InputStream downloadToStream(URL remoteUrl, Map<String, String> headers); static String pathFromParts(String ... parts); static File fromParts(String ... parts); static String resolveUnixTilde(String path); static String reverseUnixTilde(String path); static boolean isLocalPath(String path); static String encodeForURI(String filePath); static void delete(File file); static String getCanonicalPath(File file); static String stripFileUriPrefix(String path); static String getSha1Hash(File file);  }