📜  java 从字符串创建输入流 - Java 代码示例

📅  最后修改于: 2022-03-11 14:52:29.256000             🧑  作者: Mango

代码示例2
StringBuilder textBuilder = new StringBuilder();
        try (Reader reader = new BufferedReader(new InputStreamReader
            (stream, Charset.forName(StandardCharsets.UTF_8.name())))) {
            int c = 0;
            while ((c = reader.read()) != -1) {
                textBuilder.append((char) c);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
 textBuilder.toString;