I create a file using a FileOutputStream(), and after creating it I want to check if that file exists.
I have tried to see if there is something like File.exists() for it, I also looked at get file name from fileoutputstream but that solves how to get the filename, which is not my question. So I need a way to turn the FileOutputStream() to a File().
A FileOutputSteam takes either a File as an argument or a filename (which will be converted to a file by the constructor).
If you have a reference to the file, file.exists() should return true, see kotlin code example below: