How to convert a Reader to InputStream and a Writer to OutputStream?

Andrei Savu picture Andrei Savu · Sep 15, 2008 · Viewed 151.2k times · Source

Is there an easy way to avoid dealing with text encoding problems?

Answer

Ritesh Tendulkar picture Ritesh Tendulkar · Jul 13, 2010

If you are starting off with a String you can also do the following:

new ByteArrayInputStream(inputString.getBytes("UTF-8"))