Java Path Convert To pathToFullyQualifiedName(String classpath, String path)

Here you can find the source of pathToFullyQualifiedName(String classpath, String path)

Description

path To Fully Qualified Name

License

Open Source License

Declaration

public static String pathToFullyQualifiedName(String classpath, String path) 

Method Source Code

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

public class Main {
    public static String pathToFullyQualifiedName(String classpath, String path) {
        char[] buff = new char[path.length()];
        String fqname = null;//from  w  w  w. ja  v a  2s  . c o  m

        for (int i = 0; i < buff.length; i++) {
            if (path.charAt(i) == '/' || path.charAt(i) == '\\') {
                buff[i] = '.';
            } else {
                buff[i] = path.charAt(i);
            }
        }

        int classpathLength = 0;
        if (classpath != null) {
            classpathLength = classpath.length() + 1;
        }
        int classNameLength = path.length() - classpathLength - new String(".class").length();
        fqname = new String(buff, classpathLength, classNameLength);
        return fqname;
    }
}

Related

  1. pathToClassName(String path)
  2. pathToClassName(String pathName)
  3. pathToEmbedded(String relationType)
  4. pathToFields(String beanPath)
  5. pathToFile(String f)
  6. pathToName(String path)
  7. pathToName(String path, String fileName)
  8. pathTooLong()
  9. pathToPackageName(String relativeFileName, boolean leadingDot)