public class

Contents

extends Object
implements Parcelable
java.lang.Object
   ↳ com.google.android.gms.drive.Contents

Class Overview

A reference to a Drive file's contents. Any changes made to the FileDescriptor will be local to the app until close or create is called. Once closed you may no longer access the contents via this instance.

Specifically, if these contents refer to an existing file, call commitAndCloseContents(GoogleApiClient, Contents). If these are new contents, provide them to create a new file programatically via createFile(GoogleApiClient, MetadataChangeSet, Contents) or set them as the initial contents in the create file dialog: newCreateFileActivityBuilder().

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<Contents> CREATOR
Public Methods
int describeContents()
DriveId getDriveId()
Gets the DriveId for the file that owns these contents.
InputStream getInputStream()
Gets an InputStream that allows you to read this file's contents.
int getMode()
Gets the mode the contents were opened in.
OutputStream getOutputStream()
Gets an OutputStream that allows you to write new contents.
ParcelFileDescriptor getParcelFileDescriptor()
Gets a FileDescriptor that points to the Drive file's contents.
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<Contents> CREATOR

Public Methods

public int describeContents ()

public DriveId getDriveId ()

Gets the DriveId for the file that owns these contents. Will be null if these are new contents.

public InputStream getInputStream ()

Gets an InputStream that allows you to read this file's contents. This method may only be used with files opened with MODE_READ_ONLY; to read/write from a file opened with MODE_READ_WRITE, use the file descriptor returned by getParcelFileDescriptor(). This method may only be called once per Contents instance.

public int getMode ()

Gets the mode the contents were opened in.

public OutputStream getOutputStream ()

Gets an OutputStream that allows you to write new contents. This method may only be used with files opened with MODE_WRITE_ONLY; to read/write from a file opened with MODE_READ_WRITE, use the file descriptor returned by getParcelFileDescriptor(). This method may only be called once per Contents instance.

public ParcelFileDescriptor getParcelFileDescriptor ()

Gets a FileDescriptor that points to the Drive file's contents. If this file was opened with MODE_READ_ONLY or MODE_READ_WRITE, the file referenced by the FileDescriptor will contain the most recent version of the file. Otherwise, the file will be empty.

public void writeToParcel (Parcel dest, int flags)