The File
constructor taking an URI
in combination with URL#toURI()
should work:
URL url = getItSomehow();
File file = new File(url.toURI());
More Related Contents:
- How to construct a relative path in Java from two absolute paths (or URLs)?
- Get file name from URL
- Create a file from a photo URI on Android
- How do I save a String to a text file using Java?
- What is the recommended way to escape HTML symbols in plain Java?
- Java IO implementation of unix/linux “tail -f”
- URLEncoder not able to translate space character
- How to read file from relative path in Java project? java.io.File cannot find the path specified
- Read large files in Java
- How to read file from end to start (in reverse order) in Java?
- How to detect the presence of URL in a string
- Encryption of video files?
- How do I move a file from one location to another in Java?
- How to Write text file Java
- Best Way to Write Bytes in the Middle of a File in Java
- Read a file line by line in reverse order
- How should I load files into my Java application?
- How to write and read java serialized objects into a file
- File exists and IS directory, but listFiles() returns null
- How can I safely encode a string in Java to use as a filename?
- How to get list of files/directories of an directory URL?
- Java BufferedReader back to the top of a text file?
- Create folder in Android [duplicate]
- What is the idiomatic way to compose a URL or URI in Java?
- Using BufferedReader to read Text File
- java.net.URLEncoder.encode(String) is deprecated, what should I use instead?
- How to break a file into pieces using Java?
- Colorize logs in eclipse console
- java set file permissions to 777 while creating a file object [duplicate]
- Write and read multiple objects to file