/** * Return the full path of the entry. * @return a path string using {@link FileListingService#FILE_SEPARATOR} as separator. */ public String getFullPath() { if (isRoot) { return FILE_ROOT; } StringBuilder pathBuilder = new StringBuilder(); fillPathBuilder(pathBuilder, false); return pathBuilder.toString(); }
/** * Return the fully escaped path of the entry. This path is safe to use in a * shell command line. * @return a path string using {@link FileListingService#FILE_SEPARATOR} as separator */ public String getFullEscapedPath() { StringBuilder pathBuilder = new StringBuilder(); fillPathBuilder(pathBuilder, true); return pathBuilder.toString(); }
/** * Return the fully escaped path of the entry. This path is safe to use in a * shell command line. * @return a path string using {@link FileListingService#FILE_SEPARATOR} as separator */ public String getFullEscapedPath() { StringBuilder pathBuilder = new StringBuilder(); fillPathBuilder(pathBuilder, true); return pathBuilder.toString(); }
/** * Recursively fills the pathBuilder with the full path * @param pathBuilder a StringBuilder used to create the path. * @param escapePath Whether the path need to be escaped for consumption by * a shell command line. */ protected void fillPathBuilder(StringBuilder pathBuilder, boolean escapePath) { if (isRoot) { return; } if (parent != null) { parent.fillPathBuilder(pathBuilder, escapePath); } pathBuilder.append(FILE_SEPARATOR); pathBuilder.append(escapePath ? escape(name) : name); }
/** * Recursively fills the pathBuilder with the full path * @param pathBuilder a StringBuilder used to create the path. * @param escapePath Whether the path need to be escaped for consumption by * a shell command line. */ protected void fillPathBuilder(StringBuilder pathBuilder, boolean escapePath) { if (isRoot) { return; } if (parent != null) { parent.fillPathBuilder(pathBuilder, escapePath); } pathBuilder.append(FILE_SEPARATOR); pathBuilder.append(escapePath ? escape(name) : name); }
/** * Return the full path of the entry. * @return a path string using {@link FileListingService#FILE_SEPARATOR} as separator. */ public String getFullPath() { if (isRoot) { return FILE_ROOT; } StringBuilder pathBuilder = new StringBuilder(); fillPathBuilder(pathBuilder, false); return pathBuilder.toString(); }