本地资源的URI [英] URI for local resources

查看:54
本文介绍了本地资源的URI的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Java中,我可以为位于硬盘驱动器本地的文件创建URI吗?如果是这样,应该如何构造?

In Java can I create a URI for a file located locally in the hard drive? If so, how should it be constructed?

推荐答案

查看文件文档:

文件具有一个构造函数,该构造函数将URI作为参数,并且如果您想从现有文件中获取URI,它也具有方法 toURI().您可以使用它来了解应该如何做.

File has a constructor, which takes URI as a parameter, and it also has method toURI() if you want to get URI from existing file. You can play with that to understand how the things should be done.

您还可以阅读有关 URI 的信息(这不是Java术语).维基百科中有一个示例:

You can also read about URI (it's not a java term). There is an example in Wikipedia:

file:///home/username/RomeoAndJuliet.pdf

file:///home/username/RomeoAndJuliet.pdf

这篇关于本地资源的URI的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆