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 |
deleteBlockingById(String id)
Deletes the given file from the Kinvey file service.
| ||||||||||
File.DownloadMetadataAndFile |
downloadBlocking(FileMetaData metaData)
Download a given file from the Kinvey file service.
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadBlocking(Query q)
Query for files to download
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadBlocking(String filename)
This method performs a query to find a file by it's filename.
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadBlocking(String id, Query q)
Attach query parameters when requesting metadata for a specific file.
| ||||||||||
File.DownloadMetadata |
downloadMetaDataBlocking(String id)
Downloads metadata for a file, without returning the file iteself.
| ||||||||||
File.DownloadMetadataAndFileQuery |
downloadWithTTLBlocking(String id, int ttl)
Download a file with a custom Time-To-Live
Sample usage:
| ||||||||||
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)
Uploads a given file and its contents to the Kinvey file service.
| ||||||||||
File.UploadMetadataAndFile |
uploadBlocking(FileMetaData fileMetaData, AbstractInputStreamContent content)
Uploads a given file and its contents to the Kinvey file service.
| ||||||||||
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.
id | the metadata of the File to delete (requires an ID) |
---|
IOException |
---|
Download a given file from the Kinvey file service.
metaData | the metadata of the file |
---|
IOException |
---|
Query for files to download
q | the query to execute for file metadata |
---|
IOException |
---|
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 |
---|
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 |
---|
Downloads metadata for a file, without returning the file iteself.
id | the id of the metadata |
---|
IOException |
---|
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 |
---|
downloaderProgressListener | the listener to receive notifications as the download progresses |
---|
uploadProgressListener | the listener to receive notifications as the upload progresses |
---|
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 |
---|
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 |
---|