What is in Java the correct way to create a file URI for Windows? I tried
new URI("file", null, file.getAbsolutePath(), null);
but this complains about a relative path used in an absolute URI. I also tried prefixing the path with "//", but this makes 'c:' into a hostname. Then I prefixed the path with "////". A subsequent uri.getPath() then has a leading "//", which still does not seem right.
Is there any clean way to go from file.getAbsolutePath() to a URI with file:// protocol and back to a Windows path usable for new File(...) on Windows?