On Fri, 25 Jun 2021 07:18:50 GMT, Johan Vos <[email protected]> wrote:
>> Consistency with other APIs would be the main reason. We could do something
>> similar to what we do for `Image`, and treat a string without a protocol as
>> a file (although not relative to the classpath as in the case of images),
>> turning it into a `file:` URL internally where needed.
>>
>> @prrace what do you think?
>
> I agree with @kevinrushforth that if a String without protocol is passed, it
> should be treated as a file (absolute or relative to <what>?)
> I'm also not sure that the URL should be exposed here. I understand it's
> needed in the lower-level print API but you already do the conversion in the
> `syncOutputFile` method. Hence, since only the file protocol is supported, it
> might be easier for API users to pass the location of the file instead of a
> URL.
> In case later other URL protocols are supported, a property `outputURL` might
> be introduced?
I like the flexibility and consistency of defining it as a URL, as long as we
also interpret a url without a scheme as a file name. Borrowing language from
the Image docs, perhaps something like this?
The URL string can either be a URL with a "file:" protocol that can be resolved
by @link java.net.URL} or a file path that can be resolved by {@link
java.io.File}.
-------------
PR: https://git.openjdk.java.net/jfx/pull/543