target.apidocs.com.google.api.services.drive.Drive.Files.html Maven / Gradle / Ivy
Drive.Files (Drive API v2-rev20180830-1.26.0)
com.google.api.services.drive
Class Drive.Files
- java.lang.Object
-
- com.google.api.services.drive.Drive.Files
-
-
Nested Class Summary
Nested Classes
Modifier and Type
Class and Description
class
Drive.Files.Copy
class
Drive.Files.Delete
class
Drive.Files.EmptyTrash
class
Drive.Files.Export
class
Drive.Files.GenerateIds
class
Drive.Files.Get
class
Drive.Files.Insert
class
Drive.Files.List
class
Drive.Files.Patch
class
Drive.Files.Touch
class
Drive.Files.Trash
class
Drive.Files.Untrash
class
Drive.Files.Update
class
Drive.Files.Watch
-
Constructor Summary
Constructors
Constructor and Description
Files()
-
Method Summary
All Methods Instance Methods Concrete Methods
Modifier and Type
Method and Description
Drive.Files.Copy
copy(String fileId,
File content)
Creates a copy of the specified file.
Drive.Files.Delete
delete(String fileId)
Permanently deletes a file by ID.
Drive.Files.EmptyTrash
emptyTrash()
Permanently deletes all of the user's trashed files.
Drive.Files.Export
export(String fileId,
String mimeType)
Exports a Google Doc to the requested MIME type and returns the exported content.
Drive.Files.GenerateIds
generateIds()
Generates a set of file IDs which can be provided in insert requests.
Drive.Files.Get
get(String fileId)
Gets a file's metadata by ID.
Drive.Files.Insert
insert(File content)
Insert a new file.
Drive.Files.Insert
insert(File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent)
Insert a new file.
Drive.Files.List
list()
Lists the user's files.
Drive.Files.Patch
patch(String fileId,
File content)
Updates file metadata and/or content.
Drive.Files.Touch
touch(String fileId)
Set the file's updated time to the current server time.
Drive.Files.Trash
trash(String fileId)
Moves a file to the trash.
Drive.Files.Untrash
untrash(String fileId)
Restores a file from the trash.
Drive.Files.Update
update(String fileId,
File content)
Updates file metadata and/or content.
Drive.Files.Update
update(String fileId,
File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent)
Updates file metadata and/or content.
Drive.Files.Watch
watch(String fileId,
Channel content)
Subscribe to changes on a file
Create a request for the method "files.watch".
-
-
Method Detail
-
copy
public Drive.Files.Copy copy(String fileId,
File content)
throws IOException
Creates a copy of the specified file.
Create a request for the method "files.copy".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file to copy.
content
- the File
- Returns:
- the request
- Throws:
IOException
-
delete
public Drive.Files.Delete delete(String fileId)
throws IOException
Permanently deletes a file by ID. Skips the trash. The currently authenticated user must own the
file or be an organizer on the parent for Team Drive files.
Create a request for the method "files.delete".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file to delete.
- Returns:
- the request
- Throws:
IOException
-
emptyTrash
public Drive.Files.EmptyTrash emptyTrash()
throws IOException
Permanently deletes all of the user's trashed files.
Create a request for the method "files.emptyTrash".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Returns:
- the request
- Throws:
IOException
-
export
public Drive.Files.Export export(String fileId,
String mimeType)
throws IOException
Exports a Google Doc to the requested MIME type and returns the exported content. Please note
that the exported content is limited to 10MB.
Create a request for the method "files.export".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file.
mimeType
- The MIME type of the format requested for this export.
- Returns:
- the request
- Throws:
IOException
-
generateIds
public Drive.Files.GenerateIds generateIds()
throws IOException
Generates a set of file IDs which can be provided in insert requests.
Create a request for the method "files.generateIds".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Returns:
- the request
- Throws:
IOException
-
get
public Drive.Files.Get get(String fileId)
throws IOException
Gets a file's metadata by ID.
Create a request for the method "files.get".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID for the file in question.
- Returns:
- the request
- Throws:
IOException
-
insert
public Drive.Files.Insert insert(File content)
throws IOException
Insert a new file.
Create a request for the method "files.insert".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
content
- the File
- Returns:
- the request
- Throws:
IOException
-
insert
public Drive.Files.Insert insert(File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent)
throws IOException
Insert a new file.
Create a request for the method "files.insert".
This request holds the parameters needed by the the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
This method should be used for uploading media content.
- Parameters:
content
- the File
media metadata or null
if none
mediaContent
- The media HTTP content or null
if none.
- Returns:
- the request
- Throws:
IOException
- if the initialization of the request fails
-
list
public Drive.Files.List list()
throws IOException
Lists the user's files.
Create a request for the method "files.list".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Returns:
- the request
- Throws:
IOException
-
patch
public Drive.Files.Patch patch(String fileId,
File content)
throws IOException
Updates file metadata and/or content. This method supports patch semantics.
Create a request for the method "files.patch".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file to update.
content
- the File
- Returns:
- the request
- Throws:
IOException
-
touch
public Drive.Files.Touch touch(String fileId)
throws IOException
Set the file's updated time to the current server time.
Create a request for the method "files.touch".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file to update.
- Returns:
- the request
- Throws:
IOException
-
trash
public Drive.Files.Trash trash(String fileId)
throws IOException
Moves a file to the trash. The currently authenticated user must own the file or be at least a
fileOrganizer on the parent for Team Drive files.
Create a request for the method "files.trash".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file to trash.
- Returns:
- the request
- Throws:
IOException
-
untrash
public Drive.Files.Untrash untrash(String fileId)
throws IOException
Restores a file from the trash.
Create a request for the method "files.untrash".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file to untrash.
- Returns:
- the request
- Throws:
IOException
-
update
public Drive.Files.Update update(String fileId,
File content)
throws IOException
Updates file metadata and/or content.
Create a request for the method "files.update".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID of the file to update.
content
- the File
- Returns:
- the request
- Throws:
IOException
-
update
public Drive.Files.Update update(String fileId,
File content,
com.google.api.client.http.AbstractInputStreamContent mediaContent)
throws IOException
Updates file metadata and/or content.
Create a request for the method "files.update".
This request holds the parameters needed by the the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
This method should be used for uploading media content.
- Parameters:
fileId
- The ID of the file to update.
content
- the File
media metadata or null
if none
mediaContent
- The media HTTP content or null
if none.
- Returns:
- the request
- Throws:
IOException
- if the initialization of the request fails
-
watch
public Drive.Files.Watch watch(String fileId,
Channel content)
throws IOException
Subscribe to changes on a file
Create a request for the method "files.watch".
This request holds the parameters needed by the drive server. After setting any optional
parameters, call the AbstractGoogleClientRequest.execute()
method to invoke the remote operation.
- Parameters:
fileId
- The ID for the file in question.
content
- the Channel
- Returns:
- the request
- Throws:
IOException
Copyright © 2011–2018 Google. All rights reserved.