So, I we have operations that are writing to a file on a server using a BufferedWriter. Before that BufferedWriter is flushed, I want to upload the contents to an S3 bucket. Currently (and inappropriately) I am collecting each string that the BufferedWriter is writing using a StringBuilder (appending on each time), but this is a huge string (~150mb). So it would be preferable to just simply write what is stored in the BufferedWriter directly. I have been scouring the internet and SO, but I cannot find a definitive answer to this question.
Is this possible and with very little code?