繁体   English   中英

获取InputStream流式传输的文件的URL

[英]Get URL of the file streamed by InputStream

Models.jar包含文件cmudict,此jar文件作为类路径添加到项目中

InputStream in = this.getClass().getResourceAsStream("edu/cmu/sphinx/language/cmudict");

Stream, but I want to print the complete URL of the file location, which also includes the location of Models.jar file. 上面的语句访问文件 Stream,但是我想打印文件位置的完整URL,其中还包括Models.jar文件的位置。

如何做到这一点?

这可以很容易地实现:

URL resource = this.getClass().getResource();

看一下API以获得更多信息@see http://docs.oracle.com/javase/8/docs/api/java/lang/Class.html#getResource-java.lang.String-

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM