我正在使用commons-vfs,对于我的测试,我想使用 ram 文件系统。当我尝试使用时new URL("ram:///A/B/sample.jar")
,出现以下异常:
java.net.MalformedURLException: unknown protocol: ram
at java.net.URL.<init>(URL.java:592)
at java.net.URL.<init>(URL.java:482)
at java.net.URL.<init>(URL.java:431)
这是一些代码(当我使用文件协议时一切正常)
// URL is used to construct an object
obj.addArchive(new URL("ram:///A/B/sample.jar"))
...
// then VFS is used to scan the object urls
// for instance get the parent directory
FileSystemManager manager = VFS.getManager();
String directory = manager.resolveFile(obj.getPath()).getParent().getURL().toExternalForm();
我如何使用ram
协议java.net.URL
?