Utility class for loading streamed data into a seekable ParcelFileDescriptor.
This covers the use case of passing streaming data via an ACTION_SEND or similar Intent, without caching to a file. This is especially useful for encrypted files, e.g. from a de.cotech.hw.util.stream.DecryptingFileInputStream.
Unlike ParcelFileDescriptors obtained from a ParcelFileDescriptor#createPipe(), this method returns a seekable ParcelFileDescriptor. In practice, virtually all receivers of Intents with streamed data require seekable file descriptors. android.content.ContentProvider
Internally, this uses one of two mechanisms:
Note: in our tests, the technique of extracting the internal file descriptor of a MemoryFile using reflection did not actually yield a seekable ParcelFileDescriptor that worked as intended.