The doc at
Creates a stream to write to this file. If the file exists, the stream that is returned will be positioned ready for writing at the end of the file, so you might want to use deleteFile() first to write to an empty file.
Actually I found that if I do so, I am sometimes receiving a
nullptr when calling
file.createOutputStream() directly after calling
file.deleteFile() (tested on Windows 10).
However I can always get the stream and overwrite the existing file if I do this instead:
auto* stream = file.createOutputStream(); stream->setPosition(0); stream->truncate();
Maybe the doc could tell this method instead and mention that this is more safe?