public class

File

extends Object
java.lang.Object
   ↳ com.kinvey.java.File

Class Overview

Wraps the File public methods in asynchronous functionality using native Android AsyncTask.

This class is constructed via file() factory method.

The callback mechanism for this api is extended to include the progressChanged(com.kinvey.java.core.MediaHttpUploader) method, which receives notifications as the upload process transitions through and progresses with the upload. process.

Sample usage:

    mKinveyClient.file().uploadBlocking(file,  new UploaderProgressListener() {

Summary

Nested Classes
class File.Delete Initiate a delete of a particular file already known to Kinvey. 
class File.Download Initiate a download of a particular file already known to Kinvey. 
class File.GetDownloadUrl GET a temporary url for download. 
class File.GetUploadUrl GET a temporary url for uploading file contents. 
class File.Upload Initiate an upload of a particular file and its contents. 
Public Methods
File.Delete delete(String filename)
This method is deprecated. Rename to deleteBlocking(String)
File.Delete deleteBlocking(String filename)
Deletes the given file from the Kinvey file service.
File.Download download(String filename)
This method is deprecated. Renamed to downloadBlocking(String)
File.Download downloadBlocking(String filename)
Download a given file from the Kinvey file service.
File.GetDownloadUrl getDownloadUrl(String fileName)
This method is deprecated. Renamed to getDownloadUrlBlocking(String)
File.GetDownloadUrl getDownloadUrlBlocking(String fileName)
Constructs a request to retrieve a temporary url for purposes of downloading a given file already known to Kinvey.
File.GetUploadUrl getUploadUrl(String fileName)
This method is deprecated. Renamed to getUploadUrlBlocking(String)
File.GetUploadUrl getUploadUrlBlocking(String fileName)
Constructs a request to retrieve a temporary url for purposes of uploading a given file.
void setDownloaderProgressListener(DownloaderProgressListener downloaderProgressListener)
void setUploadProgressListener(UploaderProgressListener uploadProgressListener)
File.Upload upload(String fileName, AbstractInputStreamContent content)
File.Upload uploadBlocking(String fileName, AbstractInputStreamContent content)
Uploads a given file and its contents to the Kinvey file service.
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public File.Delete delete (String filename)

This method is deprecated.
Rename to deleteBlocking(String)

Deletes the given file from the Kinvey file service.

Parameters
filename the name of used in metadata to refer to the file
Returns
  • a valid DELETE request to be executed
Throws
IOException
IOException

public File.Delete deleteBlocking (String filename)

Deletes the given file from the Kinvey file service.

Parameters
filename the name of used in metadata to refer to the file
Returns
  • a valid DELETE request to be executed
Throws
IOException

public File.Download download (String filename)

This method is deprecated.
Renamed to downloadBlocking(String)

Download a given file from the Kinvey file service.

Parameters
filename the name used in metadata for downloadable file.
Returns
  • a valid request to be executed for the download operation from Kinvey file service
Throws
IOException
IOException

public File.Download downloadBlocking (String filename)

Download a given file from the Kinvey file service.

Parameters
filename the name used in metadata for downloadable file.
Returns
  • a valid request to be executed for the download operation from Kinvey file service
Throws
IOException

public File.GetDownloadUrl getDownloadUrl (String fileName)

This method is deprecated.
Renamed to getDownloadUrlBlocking(String)

Constructs a request to retrieve a temporary url for purposes of downloading a given file already known to Kinvey.

The url expires within 30 secs. of calling execute().

Parameters
fileName name of the file for which kinvey service is aware
Returns
  • request for which the temporary url can be retrieved
Throws
IOException if initializing the request fails

public File.GetDownloadUrl getDownloadUrlBlocking (String fileName)

Constructs a request to retrieve a temporary url for purposes of downloading a given file already known to Kinvey.

The url expires within 30 secs. of calling execute().

Parameters
fileName name of the file for which kinvey service is aware
Returns
  • request for which the temporary url can be retrieved
Throws
IOException if initializing the request fails

public File.GetUploadUrl getUploadUrl (String fileName)

This method is deprecated.
Renamed to getUploadUrlBlocking(String)

Constructs a request to retrieve a temporary url for purposes of uploading a given file.

The url expires within 30 secs. of calling execute().

Parameters
fileName the name of the file used in metadata
Returns
  • valid request for which the temporary upload url can be retrieved
Throws
IOException if initializing the request fails

public File.GetUploadUrl getUploadUrlBlocking (String fileName)

Constructs a request to retrieve a temporary url for purposes of uploading a given file.

The url expires within 30 secs. of calling execute().

Parameters
fileName the name of the file used in metadata
Returns
  • valid request for which the temporary upload url can be retrieved
Throws
IOException if initializing the request fails

public void setDownloaderProgressListener (DownloaderProgressListener downloaderProgressListener)

Parameters
downloaderProgressListener the listener to receive notifications as the download progresses

public void setUploadProgressListener (UploaderProgressListener uploadProgressListener)

Parameters
uploadProgressListener the listener to receive notifications as the upload progresses

public File.Upload upload (String fileName, AbstractInputStreamContent content)

This method is deprecated.
Renamed to uploadBlocking(String, com.google.api.client.http.AbstractInputStreamContent)

Uploads a given file and its contents to the Kinvey file service.

Parameters
fileName the filename used for the metadata
content the input stream from which the file contents will be sourced
Returns
  • a valid request to be executed for the upload operation to Kinvey
Throws
IOException if initializing the request fails

public File.Upload uploadBlocking (String fileName, AbstractInputStreamContent content)

Uploads a given file and its contents to the Kinvey file service.

Parameters
fileName the filename used for the metadata
content the input stream from which the file contents will be sourced
Returns
  • a valid request to be executed for the upload operation to Kinvey
Throws
IOException if initializing the request fails