【问题标题】:How to convert Chemistry ContentStream object into byte array (byte[])?如何将 Chemistry ContentStream 对象转换为字节数组(byte[])?
【发布时间】:2018-07-27 10:07:00
【问题描述】:

我正在尝试将 cmis 文档转换为字节流,以与使用 byte[] 的项目特定请求构造函数同步,从文件类型对象转换是可以的,但转换 cmis 文档是我的工作没有得到。

【问题讨论】:

  • 从 CMIS 文档的内容流中获取字节?

标签: apache fileinputstream cmis apache-chemistry


【解决方案1】:

如果您使用的是 Java 9 或更高版本,则可以这样做。

Document doc = ...;
InputStream stream = doc.getContentStream().getStream();
byte[] bytes = null;
try {
    bytes = stream.readAllBytes();
}
finally {
   stream.close();
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-10-20
    • 2011-05-13
    • 2020-02-16
    • 1970-01-01
    • 2018-09-08
    • 2021-11-30
    • 2019-03-08
    • 2019-09-02
    相关资源
    最近更新 更多