MCPcopy Create free account
hub / github.com/apache/fluss / getParent

Method getParent

fluss-common/src/main/java/org/apache/fluss/fs/FsPath.java:294–311  ·  view source on GitHub ↗

Returns the parent of a path, i.e., everything that precedes the last separator or null if at root. @return the parent of a path or null if at root.

()

Source from the content-addressed store, hash-verified

292 * @return the parent of a path or <code>null</code> if at root.
293 */
294 public FsPath getParent() {
295 final String path = uri.getPath();
296 final int lastSlash = path.lastIndexOf('/');
297 final int start = hasWindowsDrive(path, true) ? 3 : 0;
298 if ((path.length() == start)
299 || // empty path
300 (lastSlash == start && path.length() == start + 1)) { // at root
301 return null;
302 }
303 String parent;
304 if (lastSlash == -1) {
305 parent = CUR_DIR;
306 } else {
307 final int end = hasWindowsDrive(path, true) ? 3 : 0;
308 parent = path.substring(0, lastSlash == end ? end + 1 : lastSlash);
309 }
310 return new FsPath(uri.getScheme(), uri.getAuthority(), parent);
311 }
312
313 @Override
314 public String toString() {

Callers 15

writeOffsetsFileMethod · 0.95
generateMetadataFileMethod · 0.95
createJarMethod · 0.45
getVariablesMethod · 0.45
writeServiceEntriesMethod · 0.45
createMethod · 0.45
deleteMethod · 0.45
listStatusMethod · 0.45
mkdirsMethod · 0.45

Calls 5

hasWindowsDriveMethod · 0.95
getPathMethod · 0.65
getSchemeMethod · 0.65
lengthMethod · 0.45
substringMethod · 0.45

Tested by 11

createJarMethod · 0.36
writeServiceEntriesMethod · 0.36
createMethod · 0.36
deleteMethod · 0.36
listStatusMethod · 0.36
mkdirsMethod · 0.36
testDefaultDbLogDirMethod · 0.36