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

前端 未结 12 2074
慢半拍i
慢半拍i 2020-12-02 07:31

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

12条回答
  •  失恋的感觉
    2020-12-02 08:15

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

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

提交回复
热议问题