@Override public void copyTo(File destination) throws IOException { if (isDirectory()) { IO.copyDir(this.path.toFile(),destination); } else { Files.copy(this.path,destination.toPath()); } }
/** * Construct a new PathResource from a parent PathResource * and child sub path * * @param parent the parent path resource * @param childPath the child sub path */ private PathResource(PathResource parent, String childPath) { // Calculate the URI and the path separately, so that any aliasing done by // FileSystem.getPath(path,childPath) is visible as a difference to the URI // obtained via URIUtil.addDecodedPath(uri,childPath) this.path = parent.path.getFileSystem().getPath(parent.path.toString(), childPath); if (isDirectory() && !childPath.endsWith("/")) childPath += "/"; this.uri = URIUtil.addPath(parent.uri, childPath); this.alias = checkAliasPath(); }
@Override public void copyTo(File destination) throws IOException { if (isDirectory()) { IO.copyDir(this.path.toFile(),destination); } else { Files.copy(this.path,destination.toPath()); } }
/** * Construct a new PathResource from a parent PathResource * and child sub path * * @param parent the parent path resource * @param childPath the child sub path */ private PathResource(PathResource parent, String childPath) { // Calculate the URI and the path separately, so that any aliasing done by // FileSystem.getPath(path,childPath) is visible as a difference to the URI // obtained via URIUtil.addDecodedPath(uri,childPath) this.path = parent.path.getFileSystem().getPath(parent.path.toString(), childPath); if (isDirectory() && !childPath.endsWith("/")) childPath += "/"; this.uri = URIUtil.addPath(parent.uri, childPath); this.alias = checkAliasPath(); }