public PathComponents getComponents(String parent, String name) { return new PathComponents(parent, name, pathSep); }
public PathComponents(String parent, String name, String pathSep) { this.parent = parent; this.name = name; String adjusted = adjustForParent(parent, name, pathSep); this.path = !pathSep.equals(adjusted) ? trimTrailingSeparator(adjusted, pathSep) : adjusted; }
@Override public boolean equals(Object o) { return o instanceof RemoteResourceInfo && (comps.equals(((RemoteResourceInfo) o).comps)); }
public void mkdirs(String path) throws IOException { final Deque<String> dirsToMake = new LinkedList<String>(); for (PathComponents current = engine.getPathHelper().getComponents(path); ; current = engine.getPathHelper().getComponents(current.getParent())) { final FileAttributes attrs = statExistence(current.getPath()); if (attrs == null) { dirsToMake.push(current.getPath()); } else if (attrs.getType() != FileMode.Type.DIRECTORY) { throw new SFTPException(current.getPath() + " exists but is not a directory"); } else { break; } } while (!dirsToMake.isEmpty()) { mkdir(dirsToMake.pop()); } }
public String getName() { return comps.getName(); }
public String getParent() { return comps.getParent(); }
public String adjustForParent(String parent, String path) { return PathComponents.adjustForParent(parent, path, pathSep); }
@Override public int hashCode() { return comps.hashCode(); }
public String trimTrailingSeparator(String path) { return PathComponents.trimTrailingSeparator(path, pathSep); }
public String getPath() { return comps.getPath(); }
public void mkdirs(String path) throws IOException { final Deque<String> dirsToMake = new LinkedList<String>(); for (PathComponents current = engine.getPathHelper().getComponents(path); ; current = engine.getPathHelper().getComponents(current.getParent())) { final FileAttributes attrs = statExistence(current.getPath()); if (attrs == null) { dirsToMake.push(current.getPath()); } else if (attrs.getType() != FileMode.Type.DIRECTORY) { throw new SFTPException(current.getPath() + " exists but is not a directory"); } else { break; } } while (!dirsToMake.isEmpty()) { mkdir(dirsToMake.pop()); } }
public String getName() { return comps.getName(); }
public String getParent() { return comps.getParent(); }
public String adjustForParent(String parent, String path) { return PathComponents.adjustForParent(parent, path, pathSep); }
@Override public int hashCode() { return comps.hashCode(); }
public String trimTrailingSeparator(String path) { return PathComponents.trimTrailingSeparator(path, pathSep); }
public String getPath() { return comps.getPath(); }
public PathComponents(String parent, String name, String pathSep) { this.parent = parent; this.name = name; this.path = trimTrailingSeparator(adjustForParent(parent, name, pathSep), pathSep); }
public void mkdirs(String path) throws IOException { final Deque<String> dirsToMake = new LinkedList<String>(); for (PathComponents current = engine.getPathHelper().getComponents(path); ; current = engine.getPathHelper().getComponents(current.getParent())) { final FileAttributes attrs = statExistence(current.getPath()); if (attrs == null) { dirsToMake.push(current.getPath()); } else if (attrs.getType() != FileMode.Type.DIRECTORY) { throw new SFTPException(current.getPath() + " exists but is not a directory"); } else { break; } } while (!dirsToMake.isEmpty()) { mkdir(dirsToMake.pop()); } }
public String getName() { return comps.getName(); }