title: How can I mix Java OutputStream with OutputStreamWriter?
body: <p>I am currently writing a lot of text to a file using a BufferedWriter. I pass the BufferedWriter object around to various functions in my code. I now need to use a stream object in my functions in order to use the Base64OutputStream class in one place. I'm unsure how to change all of my code without needing to convert strings to bytes for every .write() call and also avoid calling helper functions like IOUtils.write() since that sounds like it would impact performance.</p>
  
  <p>Shall I just give in and call the IOUtils.write() function for the string writes? The code is certainly ugly compared to a clean call to a stream or writer write() function.</p>
  
  <p>Could I create both a stream object and a writer object and pass both around, switching between them as needed (which sounds like it would just crash or cause corruption)?</p>
  
  <p>Java is a second language for me so I don't know off the top of my head all of the possible classes and functions available to me. I would like the code to be as readable and maintainable as possible.</p>