我使用这段代码在Java中创建URI:
new URI(/*scheme*/ "scheme", /*host*/ null, /*path*/ "/42", /*fragment*/ null);当我将这个URI转换成字符串时,我会得到scheme:/42。scheme:/path格式的URI有效吗?
当我使用new URI("scheme", "", "/path", null)时,我得到了scheme:///path。我知道这是有效的(比如file:/// URI)。这些URI有不同的含义吗?
发布于 2019-04-27 09:45:36
URI = scheme:[//authority]path[?query][#fragment]…

可以跳过//authority (user+password+host+port)部分。path组件包括/之后的//authority部件。
此URI 是有效的。
https://stackoverflow.com/questions/55879041
复制相似问题