FileOperationRequest


public final class FileOperationRequest
extends Object implements Parcelable

java.lang.Object
   ↳ android.os.storage.operations.FileOperationRequest


Encapsulates a request to Move, or Copy files.

Summary

Nested classes

class FileOperationRequest.Builder

Builder for constructing FileOperationRequest instances. 

Constants

int OPERATION_COPY

Operation mode indicating that files should be copied from the source to the target.

int OPERATION_MOVE

Operation mode indicating that files should be moved from the source to the target.

Inherited constants

Fields

public static final Creator<FileOperationRequest> CREATOR

Public methods

int describeContents()

implemented for Parcelable

int getMode()

Returns the type of file operation to be performed for this request.

OperationSource getSource()

Returns the source of the file operation.

OperationTarget getTarget()

Returns the target of the file operation.

boolean shouldRegisterCompletionListener()

Returns true if a completion listener should be automatically registered for this request.

void writeToParcel(Parcel dest, int flags)

implemented for Parcelable

Inherited methods

Constants

OPERATION_COPY

Added in API level 37
public static final int OPERATION_COPY

Operation mode indicating that files should be copied from the source to the target.

A copy operation creates duplicates of the files from the OperationSource at the destination specified by the OperationTarget, while the original files remain unchanged at the source.

Constant Value: 2 (0x00000002)

OPERATION_MOVE

Added in API level 37
public static final int OPERATION_MOVE

Operation mode indicating that files should be moved from the source to the target.

A move operation results in the files being transferred to the destination specified by the OperationTarget and subsequently removed from the OperationSource.

Note: While a move will be attempted, it is possible that this still results in standard Copy + Delete behavior, as the Source/Target may not be on the same underlying storage volume.

Constant Value: 1 (0x00000001)

Fields

CREATOR

Added in API level 37
public static final Creator<FileOperationRequest> CREATOR

Public methods

describeContents

Added in API level 37
public int describeContents ()

implemented for Parcelable

Returns
int a bitmask indicating the set of special object types marshaled by this Parcelable object instance.
Value is either 0 or

getMode

Added in API level 37
public int getMode ()

Returns the type of file operation to be performed for this request.

Returns
int The operation mode, which will be either OPERATION_MOVE or OPERATION_COPY.
Value is one of the following:

getSource

Added in API level 37
public OperationSource getSource ()

Returns the source of the file operation.

Returns
OperationSource This value cannot be null.

getTarget

Added in API level 37
public OperationTarget getTarget ()

Returns the target of the file operation.

Returns
OperationTarget This value may be null.

shouldRegisterCompletionListener

Added in API level 37
public boolean shouldRegisterCompletionListener ()

Returns true if a completion listener should be automatically registered for this request.

Returns
boolean

writeToParcel

Added in API level 37
public void writeToParcel (Parcel dest, 
                int flags)

implemented for Parcelable

Parameters
dest Parcel: This value cannot be null.

flags int: Additional flags about how the object should be written. May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE.
Value is either 0 or a combination of the following: