Local file protocol for java.net.URL

后端 未结 2 578
难免孤独
难免孤独 2020-12-06 11:32

What\'s the protocol for local files using URL? I\'ve downloaded a file using Java and I need to know how to access it, not using File, but using URL.

相关标签:
2条回答
  • 2020-12-06 11:41

    Unix

    file://localhost/<path>
    file:///<path>
    

    Windows

    file://localhost/<drive>|/<path>
    file:///<drive>|/<path>
    file://localhost/<drive>:/<path>
    file:///<drive>:/<path>
    

    For more information see the related Wikipedia article.

    0 讨论(0)
  • 2020-12-06 11:42

    You may use file:/// and file path. For e.g. file:///c:/temp.txt

    0 讨论(0)
提交回复
热议问题