Java Utililty Methods File Path Create

List of utility methods to do File Path Create

Description

The list of methods to do File Path Create are organized into topic(s).

Method

StringbuildPath(String[] seperatedName)
build Path
String iconName = "textures/items/";
for (int i = 1; i < seperatedName.length - 1; i++) {
    iconName += seperatedName[i] + "/";
iconName += seperatedName[seperatedName.length - 1] + ".png";
return iconName;
String[]buildPathArray(String xpath)
Build the input for the get...FromPath methods.
String[] result = null;
if (xpath != null && xpath.charAt(0) != '/') {
    int components = 1;
    int i, l;
    l = xpath.length();
    boolean found = false;
    i = 0;
    while (i < l && found == false) {
...
StringbuildPathString(String[] folders, boolean addDefaultValues)
build Path String
String del = System.getProperty("path.separator");
StringBuffer path = new StringBuffer();
if (null != folders && folders.length > 0) {
    for (String folder : folders) {
        path.append(folder).append(del);
if (addDefaultValues) {
...
StringbuildPathToApiTargetFolder(String apiPackageName, String path)
build Path To Api Target Folder
return path + convertPackageNameToFolderPath(apiPackageName);
StringfilePath(String compchartimage)
file Path
return appHomeDir + compchartimage;
StringfilePath(String dirPath, String fileName)
file Path
return dirPath + "/" + fileName;
StringfilePath2PackageName(String entryName)
file Path Package Name
String pkgName = entryName.replace('/', '.').replace('\\', '.');
pkgName = pkgName.endsWith(".") ? pkgName.substring(0, pkgName.length() - 1) : pkgName;
return pkgName;
StringfilePathBlackList(String value)
file Path Black List
String returnValue = value;
if (returnValue == null || returnValue.trim().equals("")) {
    return "";
returnValue = returnValue.replaceAll("\\.\\./", ""); 
returnValue = returnValue.replaceAll("\\.\\.\\\\", ""); 
return returnValue;
voidfilePathCheck(final String filePath)
Check that the path is 'absolute' on the server
if (filePath.charAt(0) != '/') {
    throw new IllegalArgumentException("Remote path should start with '/'"); 
StringfilePathGen(String oldPath, String newExtension, String newFileName)
Create a copy of a file in same directory but can rename and change it's extension
if (newFileName.contains(".")) {
    newFileName = newFileName.substring(0, newFileName.lastIndexOf('.'));
if (newExtension.charAt(0) != '.') {
    newExtension = "." + newExtension;
String newPath = "";
if (newFileName != null) {
...