Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在客户端,我有LZMA-JS压缩纯文本并将其作为字符串发送到服务器。到目前为止,我发现的所有 LZMA Java 实现都将 File 或 InputStream 作为参数。是否有任何直接使用 String 作为输入的实现,或者我应该围绕从客户端获取的数据编写一个 InputStream String 包装器?
只需将您的字符串包装在 InputStream 中:
InputStream stream = new ByteArrayInputStream( lzmaString.getBytes(StandardCharsets.UTF_8) );
现在您可以使用 String 作为库想要使用的 InputStream 的源。