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

<init>

FileUrlResource(url: URL)

Create a new FileUrlResource based on the given URL object.

Note that this does not enforce "file" as URL protocol. If a protocol is known to be resolvable to a file,

Parameters

url - a URL

See Also
ResourceUtils#isFileURL(URL)#getFile()

FileUrlResource(location: String)

Create a new FileUrlResource based on the given file location, using the URL protocol "file".

The given parts will automatically get encoded if necessary.

Parameters

location - the location (i.e. the file path within that protocol)

Exceptions

MalformedURLException - if the given URL specification is not valid

See Also
UrlResource#UrlResource(String, String)ResourceUtils#URL_PROTOCOL_FILE