implementation of issue #22305

Comment From: wilkinsona

Thanks for the PR, @Tharik67. I'd prefer to try and solve this in a way that doesn't expose the use of a temporary file in the public API of EntryWriter.