<bdo id='8oGis'></bdo><ul id='8oGis'></ul>
    1. <i id='8oGis'><tr id='8oGis'><dt id='8oGis'><q id='8oGis'><span id='8oGis'><b id='8oGis'><form id='8oGis'><ins id='8oGis'></ins><ul id='8oGis'></ul><sub id='8oGis'></sub></form><legend id='8oGis'></legend><bdo id='8oGis'><pre id='8oGis'><center id='8oGis'></center></pre></bdo></b><th id='8oGis'></th></span></q></dt></tr></i><div id='8oGis'><tfoot id='8oGis'></tfoot><dl id='8oGis'><fieldset id='8oGis'></fieldset></dl></div>

      <tfoot id='8oGis'></tfoot>

      <small id='8oGis'></small><noframes id='8oGis'>

    2. <legend id='8oGis'><style id='8oGis'><dir id='8oGis'><q id='8oGis'></q></dir></style></legend>

      如何在 Java 中将字符串转换为 InputStream?

      时间:2023-07-27
        <bdo id='brA4v'></bdo><ul id='brA4v'></ul>

              1. <small id='brA4v'></small><noframes id='brA4v'>

              2. <tfoot id='brA4v'></tfoot>
              3. <i id='brA4v'><tr id='brA4v'><dt id='brA4v'><q id='brA4v'><span id='brA4v'><b id='brA4v'><form id='brA4v'><ins id='brA4v'></ins><ul id='brA4v'></ul><sub id='brA4v'></sub></form><legend id='brA4v'></legend><bdo id='brA4v'><pre id='brA4v'><center id='brA4v'></center></pre></bdo></b><th id='brA4v'></th></span></q></dt></tr></i><div id='brA4v'><tfoot id='brA4v'></tfoot><dl id='brA4v'><fieldset id='brA4v'></fieldset></dl></div>

                  <tbody id='brA4v'></tbody>
                <legend id='brA4v'><style id='brA4v'><dir id='brA4v'><q id='brA4v'></q></dir></style></legend>
              4. 本文介绍了如何在 Java 中将字符串转换为 InputStream?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                问题描述

                给定一个字符串:

                String exampleString = "example";
                

                如何将其转换为 InputStream?

                推荐答案

                像这样:

                InputStream stream = new ByteArrayInputStream(exampleString.getBytes(StandardCharsets.UTF_8));
                

                请注意,这假设您需要一个 InputStream,它是一个字节流,表示编码为 UTF-8 的原始字符串.

                Note that this assumes that you want an InputStream that is a stream of bytes that represent your original string encoded as UTF-8.

                对于低于 7 的 Java 版本,将 StandardCharsets.UTF_8 替换为 "UTF-8".

                For versions of Java less than 7, replace StandardCharsets.UTF_8 with "UTF-8".

                这篇关于如何在 Java 中将字符串转换为 InputStream?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                上一篇:如何将 Long 转换为 byte[] 并返回到 java 下一篇:由于java语言规则或jvm,添加字节转换为int?

                相关文章

                最新文章

                1. <tfoot id='lzmcD'></tfoot>
                  <i id='lzmcD'><tr id='lzmcD'><dt id='lzmcD'><q id='lzmcD'><span id='lzmcD'><b id='lzmcD'><form id='lzmcD'><ins id='lzmcD'></ins><ul id='lzmcD'></ul><sub id='lzmcD'></sub></form><legend id='lzmcD'></legend><bdo id='lzmcD'><pre id='lzmcD'><center id='lzmcD'></center></pre></bdo></b><th id='lzmcD'></th></span></q></dt></tr></i><div id='lzmcD'><tfoot id='lzmcD'></tfoot><dl id='lzmcD'><fieldset id='lzmcD'></fieldset></dl></div>
                2. <small id='lzmcD'></small><noframes id='lzmcD'>

                      <bdo id='lzmcD'></bdo><ul id='lzmcD'></ul>

                    <legend id='lzmcD'><style id='lzmcD'><dir id='lzmcD'><q id='lzmcD'></q></dir></style></legend>