如何将 Reader 转换为 InputStream,将 Writer 转换为 OutputStream? [英] How to convert a Reader to InputStream and a Writer to OutputStream?
本文介绍了如何将 Reader 转换为 InputStream,将 Writer 转换为 OutputStream?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否有一种简单的方法可以避免处理文本编码问题?
Is there an easy way to avoid dealing with text encoding problems?
推荐答案
你无法真正避免处理文本编码问题,但在 Apache Commons 中有现有的解决方案:
You can't really avoid dealing with the text encoding issues, but there are existing solutions in Apache Commons:
Reader
到InputStream
:ReaderInputStream
Writer
到OutputStream
:WriterOutputStream
您只需要选择您选择的编码.
You just need to pick the encoding of your choice.
这篇关于如何将 Reader 转换为 InputStream,将 Writer 转换为 OutputStream?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文