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

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

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

12条回答
  •  情书的邮戳
    2020-12-02 08:00

    For Reading a string in a stream using just what java supplies.

    InputStream s = new BufferedInputStream( new ReaderInputStream( new StringReader("a string")));
    

提交回复
热议问题