标签: java file url uri
有没有办法通过File Api返回file:///。现在,我有:
URL url = file.toURI().toURL();
上面的代码返回file:/<location>,但我希望它返回file:///<location>。我能想到的唯一方法是replace("file:/", "file:///")。还有更好的方法吗?
file:/<location>
file:///<location>
replace("file:/", "file:///")