RFR: 8298318: (fs) APIs for handling filename extensions [v4]

Roger Riggs rriggs at openjdk.org
Mon Mar 11 16:34:06 UTC 2024


On Fri, 8 Mar 2024 19:36:15 GMT, Louis Bergelson <duke at openjdk.org> wrote:

>> I would think that manipulations of filename components of a URI/URL would require extracting/converting to a file path first. Path applies to file system names. One could imagine a FileSystem whose Paths were URIs and then yes it could/should implement the file extension related methods to manipulate the file extension and produce valid URIs.
>
> Yes, our software uses a number of alternative file systems in order to treat file access uniformly across different domains.   One for google cloud storage, one for amazon, one for arbitrary http paths, etc.   They're constructed using the `Path.of(URI)` mechanism which matches filesystems by URI scheme.  I just wanted to point out that invariant around handling of toString() wouldn't hold for non-default implementations of Path so maybe it should be stated more generally in terms of path operations instead of in terms of string concatenation.

It make sense to express the behavior in terms of Path though the default implementation needs to be able to take advantage of the mapping between strings and Paths to be able to describe and define the behavior that is consistent across filesystems.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/16226#discussion_r1519870401


More information about the nio-dev mailing list