@Test
public void testURL() throws MalformedURLException {
//本地文件转URI
URI uri=new File("d:/temp/a.txt").toURI();
//本地文件转URL
URL url=new File("d:/temp/a.txt").toURI().toURL();
System.out.println(uri);
System.out.println(url);
}
备忘一下。