Java Utililty Methods Root Path Get

List of utility methods to do Root Path Get

Description

The list of methods to do Root Path Get are organized into topic(s).

Method

StringgetRootFloorPlansDir()
get Root Floor Plans Dir
return FLOOR_PLANS_ROOT_DIR;
StringgetRootFolder(final File file, final String headerFileName)
get Root Folder
final ZipFile productZip = new ZipFile(file, ZipFile.OPEN_READ);
final Optional result = productZip.stream().filter(ze -> !ze.isDirectory())
        .filter(ze -> ze.getName().toLowerCase().endsWith(headerFileName)).findFirst();
ZipEntry ze = (ZipEntry) result.get();
String path = ze.toString();
int sepIndex = path.lastIndexOf('/');
if (sepIndex > 0) {
    return path.substring(0, sepIndex) + '/';
...
StringgetRootFolderPath(File file)
Get Path from the update root Folder.
String absolutePath = file.getAbsolutePath();
return absolutePath.substring(absolutePath.indexOf("update"), absolutePath.length());
StringgetRootName(File f)
get Root Name
String fnm = f.getName();
int index = fnm.lastIndexOf(".");
return fnm.substring(0, index == -1 ? fnm.length() : index);
StringgetRootName(String fnm)
get Root Name
int ild = fnm.lastIndexOf(".");
String root = fnm;
if (ild > 0) {
    root = fnm.substring(0, fnm.lastIndexOf("."));
return root;
StringgetRootName(String pathname)
Returns the whole 'pathname' without the extension ('.'
String name = new java.io.File(pathname).getName();
int i = name.lastIndexOf('.');
return (i < 0) ? pathname : pathname.substring(0, pathname.length() + i - name.length());
StringgetRootPath()
get Root Path
return File.listRoots()[0].getAbsolutePath();
StringgetRootPath()
get Root Path
File file = new File(System.getProperty("user.dir"));
String path = file.getAbsolutePath().replace('\\', '/');
path = path.substring(0, path.indexOf('/'));
return path;
StringgetRootPath()
get Root Path
return getPath();
FilegetRootPath(String testDir)
get Root Path
File baseDir = new File(System.getProperty("basedir", "restatic-core"));
File rootPath = new File(baseDir, testDir);
return rootPath;