List of usage examples for org.apache.hadoop.fs Path depth
public int depth()
From source file:org.icgc.dcc.submission.sftp.fs.RootHdfsSshFile.java
License:Open Source License
@Override public HdfsSshFile getChild(Path filePath) { try {/*from w w w .j ava 2s . c o m*/ switch (filePath.depth()) { case 0: return this; case 1: return new SubmissionDirectoryHdfsSshFile(context, this, filePath.getName()); case 2: val parentDir = new SubmissionDirectoryHdfsSshFile(context, this, filePath.getParent().getName()); return new FileHdfsSshFile(context, parentDir, filePath.getName()); } } catch (Exception e) { return handleException(HdfsSshFile.class, e); } return handleException(HdfsSshFile.class, "Invalid file path: %s%s", getAbsolutePath(), filePath.toString()); }