Apache telnet使用 InputStream
,我想要read作为字符串(或类似字符串的数据)。
如何将InputStream
转换为(对我来说)更容易处理的东西,StringBuffer
或类似的东西。
最佳答案
您可以考虑IOUtils.toString(is)来自Apache Common IO
public static String toString(InputStream input)
throws IOException
来自文档:
This method buffers the input internally, so there is no need to use a BufferedInputStream.
关于java - 将输入流转换为字符串(telnet),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18480898/