I am using some code from a different program. I don't fully understand how it works, but I know how I can use it. The program uses a text file from your pc, but the text file I want to use is not a file I have downloaded. It's 'an online file' as a link that starts with https://, that I want to use. For the program to work, it needs the file to be a Path object, but I can't figure out, how to make the URL into a Path, without the program stopping and giving an error. I have tried using the [url].toURI(). Didn't work. I have tried different methods of making the URL, but I couldn't find a method, that works.
It would make most sense for the program to not download the file, but it is a possibility, if it's not possible to make the other thing work (I already tried, and I also had problems with that. Most methods I could find didn't work, because some lines got mixed, which makes it not work with the program).
Edit: As I expected, it's not possible to do, so I need to find out how I can download the text file, as the exact same file. The lines needs to stay the same, something can't be moved to a different line.
Files.copy(url.openStream(), Files.createTempFile());but you will need to close (and maybe buffer) the stream and save thePathobject to a variable.