Closed kazurayam closed 2 years ago
I made a test as follows:
@Test
public void testFileURLSupport() throws MalformedURLException {
String fileUrlString = "file:/Users/who/bar/baz.txt";
URL url = new URL(fileUrlString);
Metadata md = new Metadata.Builder(url).build();
System.out.println(md.toJson(true));
assertTrue(md.containsKey("URL.protocol"), "URL.protocol is not contained");
assertEquals("file", md.get("URL.protocol"));
assertTrue(md.containsKey("URL.path"), "URL.path is not contained");
assertEquals("/Users/who/bar/baz.txt", md.get("URL.path"));
}
It emitted :
{
"URL.host": {
"key": "URL.host",
"value": ""
},
"URL.path": {
"key": "URL.path",
"value": "/Users/who/bar/baz.txt"
},
"URL.protocol": {
"key": "URL.protocol",
"value": "file"
}
}
So the file URL is already supported by Metadata.Builder(URL) method
not only URL in
http://
+https://
, but alsofile: