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.
file is a registered URI scheme (for "Host-specific file names"). So yes, file URIs are URLs.
To download a file from a given URL using the Apache Commons IO we will require the FileUtils class of the package. There is only a single line of code required to download a file, which looks like: FileUtils. copyURLToFile( new URL("http://example.com/my-file-path.txt"), new File("/Users/username/Documents/file_name.
file://localhost/<path>
file:///<path>
file://localhost/<drive>|/<path>
file:///<drive>|/<path>
file://localhost/<drive>:/<path>
file:///<drive>:/<path>
For more information see the related Wikipedia article.
You may use file:/// and file path. For e.g. file:///c:/temp.txt
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With