我可以直接在 ContentProvider 的 open ParcelFileDescriptor openFile() 中传递我的 InputStream 吗?

Can I pass my InputStream directly in open ParcelFileDescriptor openFile() of ContentProvider?

我有一个要传递给 ContentProvider 的 openFile() 方法的 InputStream。我能否以某种方式直接传递我的 InputStream,以某种方式将其包装在 ParcelFileDescriptor 中?或者我是否必须创建一个管道,然后手动从 InputStream 读取并写入管道的 OutputStream?如果可以的话,我想把流传下去,但也许这是不可能的?

你必须为此使用管道。幸运的是,有一个帮助方法可以让您的生活更轻松,请参阅 openPipeHelper