Udostępnij za pośrednictwem


BackupAgent.OnRestoreFile Method

Definition

Handle the data delivered via the given file descriptor during a full restore operation.

[Android.Runtime.Register("onRestoreFile", "(Landroid/os/ParcelFileDescriptor;JLjava/io/File;IJJ)V", "GetOnRestoreFile_Landroid_os_ParcelFileDescriptor_JLjava_io_File_IJJHandler")]
public virtual void OnRestoreFile (Android.OS.ParcelFileDescriptor? data, long size, Java.IO.File? destination, Android.App.Backup.BackupFileType type, long mode, long mtime);
[<Android.Runtime.Register("onRestoreFile", "(Landroid/os/ParcelFileDescriptor;JLjava/io/File;IJJ)V", "GetOnRestoreFile_Landroid_os_ParcelFileDescriptor_JLjava_io_File_IJJHandler")>]
abstract member OnRestoreFile : Android.OS.ParcelFileDescriptor * int64 * Java.IO.File * Android.App.Backup.BackupFileType * int64 * int64 -> unit
override this.OnRestoreFile : Android.OS.ParcelFileDescriptor * int64 * Java.IO.File * Android.App.Backup.BackupFileType * int64 * int64 -> unit

Parameters

data
ParcelFileDescriptor

A read-only file descriptor from which the agent can read size bytes of file data.

size
Int64

The number of bytes of file content to be restored to the given destination. If the file system object being restored is a directory, size will be zero.

destination
File

The File on disk to be restored with the given data.

type
BackupFileType

The kind of file system object being restored. This will be either BackupAgent#TYPE_FILE or BackupAgent#TYPE_DIRECTORY.

mode
Int64

The access mode to be assigned to the destination after its data is written. This is in the standard format used by chmod().

mtime
Int64

The modification time of the file when it was backed up, suitable to be assigned to the file after its data is written.

Attributes

Exceptions

Remarks

Handle the data delivered via the given file descriptor during a full restore operation. The agent is given the path to the file's original location as well as its size and metadata.

The file descriptor can only be read for size bytes; attempting to read more data has undefined behavior.

The default implementation creates the destination file/directory and populates it with the data from the file descriptor, then sets the file's access mode and modification time to match the restore arguments.

Java documentation for android.app.backup.BackupAgent.onRestoreFile(android.os.ParcelFileDescriptor, long, java.io.File, int, long, long).

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