spring-framework / org.springframework.core.io / PathResource / <init>

<init>

PathResource(path: Path)

Create a new PathResource from a Path handle.

Note: Unlike FileSystemResource, when building relative resources via #createRelative, the relative path will be built underneath the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!

Parameters

path - a Path handle

PathResource(path: String)

Create a new PathResource from a Path handle.

Note: Unlike FileSystemResource, when building relative resources via #createRelative, the relative path will be built underneath the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!

Parameters

path - a path

See Also
java.nio.file.Paths#get(String, String...)

PathResource(uri: URI)

Create a new PathResource from a Path handle.

Note: Unlike FileSystemResource, when building relative resources via #createRelative, the relative path will be built underneath the given root: e.g. Paths.get("C:/dir1/"), relative path "dir2" -> "C:/dir1/dir2"!

Parameters

uri - a path URI

See Also
java.nio.file.Paths#get(URI)