de.charite.compbio.jannovar.impl.util.PathUtil Maven / Gradle / Ivy
package de.charite.compbio.jannovar.impl.util;
import java.io.File;
/**
* Utility class with static methods for path manipulation.
*
* @author Manuel Holtgrewe
*/
public final class PathUtil {
/**
* Join file name components.
*
*
* String path = Path.join("path", "to", "file");
* // => path == "path/to/file";
*
*
* Note that this also works fine for joining paths in URLs.
*
* @param components file name components to join
* @return joint file name components of components
*/
public static String join(String... components) {
File file = new File(components[0]);
for (int i = 1; i < components.length; ++i)
file = new File(file, components[i]);
return file.getPath();
}
}