java.lang.Object | |
↳ | com.kinvey.java.File |
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:
{@code mKinveyClient.file().uploadBlocking("myFileName.txt", file, new UploaderProgressListener() {
Nested Classes | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
class | File.DeleteFile | ||||||||||
class | File.DownloadMetadata | This class will upload new file metadata without actually effecting the file Note it is not recommended to change the filename without ensuring a file exists with the new name. | |||||||||
class | File.DownloadMetadataAndFile | This class gets a FileMetaData object from Kinvey, and then downloads the associated File
|
|||||||||
class | File.DownloadMetadataAndFileQuery | This class gets a FileMetaData object from Kinvey, and then downloads the associated File
|
|||||||||
class | File.UploadMetadata | This class will upload new file metadata without actually effecting the file Note it is not recommended to change the filename without ensuring a file exists with the new name. | |||||||||
class | File.UploadMetadataAndFile | This class uploads a FileMetaData object to Kinvey, returning another FileMetaData containing the upload URL
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
void | clearCustomRequestProperties() | ||||||||||
File.DeleteFile |
deleteBlocking(FileMetaData metaData)
Deletes the given file from the Kinvey file service.
| ||||||||||
File.DeleteFile |
deleteBlocking(String fileID)
Deletes the given file from the Kinvey file service.
| ||||||||||
File.DeleteFile |
deleteBlockingById(String id)
Deletes the given file from the Kinvey file service.
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadBlocking(Query q)
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadBlocking(String filename)
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadBlocking(String id, Query q)
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
| ||||||||||
File.DownloadMetadataAndFile |
downloadBlocking(FileMetaData metaData)
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
| ||||||||||
File.DownloadMetadata |
downloadMetaDataBlocking(String id)
Downloads metadata for a file, without returning the file iteself.
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadWithTTLBlocking(String id, int ttl)
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
| ||||||||||
File.DownloadMetadataAndFileQuery |
prepDownloadBlocking(String filename)
Prepares a request to query to find a file by it's filename.
| ||||||||||
File.DownloadMetadataAndFile |
prepDownloadBlocking(FileMetaData metaData)
Prepares a request to download a given file from the Kinvey file service.
| ||||||||||
File.DownloadMetadataAndFileQuery |
prepDownloadBlocking(String id, Query q)
Prepares a request to attach query parameters when requesting metadata for a specific file.
| ||||||||||
File.DownloadMetadataAndFileQuery |
prepDownloadBlocking(Query q)
Prepares a request to Query for files to download
| ||||||||||
File.DownloadMetadataAndFileQuery |
prepDownloadWithTTLBlocking(String id, int ttl)
Prepares a request to download a file with a custom Time-To-Live
Sample usage:
| ||||||||||
File.UploadMetadataAndFile |
prepUploadBlocking(String fileName, AbstractInputStreamContent content)
Prepares a request to upload a given file and its contents to the Kinvey file service.
| ||||||||||
File.UploadMetadataAndFile |
prepUploadBlocking(FileMetaData fileMetaData, AbstractInputStreamContent content)
Prepares a request to upload a given file and its contents to the Kinvey file service.
| ||||||||||
void | setCache(FilePolicy policy, FileCache cache) | ||||||||||
void | setClientAppVersion(String appVersion) | ||||||||||
void | setClientAppVersion(int major, int minor, int revision) | ||||||||||
void | setCustomRequestProperties(GenericJson customheaders) | ||||||||||
void | setCustomRequestProperty(String key, Object value) | ||||||||||
void | setDownloaderProgressListener(DownloaderProgressListener downloaderProgressListener) | ||||||||||
void | setUploadProgressListener(UploaderProgressListener uploadProgressListener) | ||||||||||
File.UploadMetadataAndFile |
uploadBlocking(String fileName, AbstractInputStreamContent content)
This method is deprecated.
use upload methods which take an `InputStream` or a `File`
| ||||||||||
File.UploadMetadataAndFile |
uploadBlocking(FileMetaData fileMetaData, AbstractInputStreamContent content)
This method is deprecated.
use upload methods which take an `InputStream` or a `File`
| ||||||||||
File.UploadMetadata |
uploadMetaDataBlocking(FileMetaData metaData)
Uploads metadata for a file, without modifying the file iteself.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Deletes the given file from the Kinvey file service.
metaData | the metadata of the File to delete (requires an ID) |
---|
IOException |
---|
Deletes the given file from the Kinvey file service.
fileID | the _id of the file to delete |
---|
IOException |
---|
Deletes the given file from the Kinvey file service.
id | the metadata of the File to delete (requires an ID) |
---|
IOException |
---|
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
Query for files to download
q | the query to execute for file metadata |
---|
IOException | |
IOException |
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
This method performs a query to find a file by it's filename. As Kinvey File now supports non-unique file names, this method will only return a single file with this name.@return
IOException | |
IOException |
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
Attach query parameters when requesting metadata for a specific file. Use this method to specify a custom time to live.
Sample usage:
Query q = new Query();
q.equals("ttl_in_seconds", 3600); //set a new ttl for the download URL
OutputStream out = new ByteArrayOutputStream(...);
mKinveyClient.file().downloadBlocking("myFileName.txt", q).executeAndDownloadTo(out);
id | - the unique id of the file |
---|---|
q | - the query to execute |
IOException | |
IOException |
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
Download a given file from the Kinvey file service.
metaData | the metadata of the file |
---|
IOException | |
IOException |
Downloads metadata for a file, without returning the file iteself.
id | the id of the metadata |
---|
IOException |
---|
This method is deprecated.
use the download methods which take an `Outputstream` or a `File`
Download a file with a custom Time-To-Live
Sample usage:
OutputStream out = new ByteArrayOutputStream(...);
mKinveyClient.file().downloadBlocking("myFileName.txt", 3600).executeAndDownloadTo(out);
id | - the unique _id of the file to download |
---|---|
ttl | - a custom TTL, in milliseconds |
File.DownloadMetadataAndFileQuery
request ready to be executed.IOException | |
IOException |
Prepares a request to query to find a file by it's filename. As Kinvey File now supports non-unique file names, this method will only return a single file with this name.@return
IOException |
---|
Prepares a request to download a given file from the Kinvey file service.
metaData | the metadata of the file |
---|
IOException |
---|
Prepares a request to attach query parameters when requesting metadata for a specific file. Use this method to specify a custom time to live.
Sample usage:
Query q = new Query();
q.equals("ttl_in_seconds", 3600); //set a new ttl for the download URL
OutputStream out = new ByteArrayOutputStream(...);
mKinveyClient.file().downloadBlocking("myFileName.txt", q).executeAndDownloadTo(out);
id | - the unique id of the file |
---|---|
q | - the query to execute |
IOException |
---|
Prepares a request to Query for files to download
q | the query to execute for file metadata |
---|
IOException |
---|
Prepares a request to download a file with a custom Time-To-Live
Sample usage:
OutputStream out = new ByteArrayOutputStream(...);
mKinveyClient.file().downloadBlocking("myFileName.txt", 3600).executeAndDownloadTo(out);
id | - the unique _id of the file to download |
---|---|
ttl | - a custom TTL, in milliseconds |
File.DownloadMetadataAndFileQuery
request ready to be executed.IOException |
---|
Prepares a request to upload a given file and its contents to the Kinvey file service.
fileName | the filename used for the metadata |
---|---|
content | the input stream from which the file contents will be sourced |
IOException | if initializing the request fails |
---|
Prepares a request to upload a given file and its contents to the Kinvey file service.
fileMetaData | Metadata object about the file to uplaod |
---|---|
content | the input stream from which the file contents will be sourced |
IOException | if initializing the request fails |
---|
downloaderProgressListener | the listener to receive notifications as the download progresses |
---|
uploadProgressListener | the listener to receive notifications as the upload progresses |
---|
This method is deprecated.
use upload methods which take an `InputStream` or a `File`
Uploads a given file and its contents to the Kinvey file service.
fileName | the filename used for the metadata |
---|---|
content | the input stream from which the file contents will be sourced |
IOException | if initializing the request fails |
---|
This method is deprecated.
use upload methods which take an `InputStream` or a `File`
Uploads a given file and its contents to the Kinvey file service.
fileMetaData | Metadata object about the file to uplaod |
---|---|
content | the input stream from which the file contents will be sourced |
IOException | if initializing the request fails |
---|
Uploads metadata for a file, without modifying the file iteself.
metaData | the metadata of the File to upload |
---|
IOException |
---|