StorageManager.OpenProxyFileDescriptor Method

Definition

Opens a seekable ParcelFileDescriptor that proxies all low-level I/O requests back to the given ProxyFileDescriptorCallback.

[Android.Runtime.Register("openProxyFileDescriptor", "(ILandroid/os/ProxyFileDescriptorCallback;Landroid/os/Handler;)Landroid/os/ParcelFileDescriptor;", "GetOpenProxyFileDescriptor_ILandroid_os_ProxyFileDescriptorCallback_Landroid_os_Handler_Handler", ApiSince=26)]
public virtual Android.OS.ParcelFileDescriptor OpenProxyFileDescriptor (Android.OS.ParcelFileMode mode, Android.OS.ProxyFileDescriptorCallback? callback, Android.OS.Handler? handler);
[<Android.Runtime.Register("openProxyFileDescriptor", "(ILandroid/os/ProxyFileDescriptorCallback;Landroid/os/Handler;)Landroid/os/ParcelFileDescriptor;", "GetOpenProxyFileDescriptor_ILandroid_os_ProxyFileDescriptorCallback_Landroid_os_Handler_Handler", ApiSince=26)>]
abstract member OpenProxyFileDescriptor : Android.OS.ParcelFileMode * Android.OS.ProxyFileDescriptorCallback * Android.OS.Handler -> Android.OS.ParcelFileDescriptor
override this.OpenProxyFileDescriptor : Android.OS.ParcelFileMode * Android.OS.ProxyFileDescriptorCallback * Android.OS.Handler -> Android.OS.ParcelFileDescriptor

Parameters

mode
ParcelFileMode

The desired access mode, must be one of ParcelFileDescriptor#MODE_READ_ONLY, ParcelFileDescriptor#MODE_WRITE_ONLY, or ParcelFileDescriptor#MODE_READ_WRITE

callback
ProxyFileDescriptorCallback

Callback to process file operation requests issued on returned file descriptor.

handler
Handler

Handler that invokes callback methods.

Returns

Seekable ParcelFileDescriptor.

Attributes

Remarks

Opens a seekable ParcelFileDescriptor that proxies all low-level I/O requests back to the given ProxyFileDescriptorCallback.

This can be useful when you want to provide quick access to a large file that isn't backed by a real file on disk, such as a file on a network share, cloud storage service, etc. As an example, you could respond to a ContentResolver#openFileDescriptor(android.net.Uri, String) request by returning a ParcelFileDescriptor created with this method, and then stream the content on-demand as requested.

Another useful example might be where you have an encrypted file that you're willing to decrypt on-demand, but where you want to avoid persisting the cleartext version.

Java documentation for android.os.storage.StorageManager.openProxyFileDescriptor(int, android.os.ProxyFileDescriptorCallback, android.os.Handler).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to