Package com.bitheads.braincloud.services
Class FileService
java.lang.Object
com.bitheads.braincloud.services.FileService
Created by bradleyh on 3/29/2016.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidcancelUpload(String uploadId) Method cancels an upload.voiddeleteUserFile(String cloudPath, String cloudFilename, IServerCallback callback) Deletes a single user file.voiddeleteUserFiles(String cloudPath, boolean recurse, IServerCallback callback) Delete multiple user filesvoidgetCDNUrl(String cloudPath, String cloudFileName, IServerCallback callback) Returns the CDN url for a file objectlonggetUploadBytesTransferred(String uploadId) Returns the number of bytes uploaded or -1 if upload not found.doublegetUploadProgress(String uploadId) Returns the progress of the given upload from 0.0 to 1.0 or -1 if upload not found.longgetUploadTotalBytesToTransfer(String uploadId) Returns the total number of bytes that will be uploaded or -1 if upload not found.voidlistUserFiles(IServerCallback callback) List all user filesvoidlistUserFiles(String cloudPath, boolean recurse, IServerCallback callback) List user files from the given cloud pathbooleanuploadFile(String cloudPath, String cloudFilename, boolean shareable, boolean replaceIfExists, String localPath, IServerCallback callback) Prepares a user file upload.
-
Constructor Details
-
FileService
-
-
Method Details
-
uploadFile
public boolean uploadFile(String cloudPath, String cloudFilename, boolean shareable, boolean replaceIfExists, String localPath, IServerCallback callback) Prepares a user file upload. On success the file will begin uploading to the brainCloud server. To be informed of success/failure of the upload register an IFileUploadCallback with the BrainCloudClient class.- Parameters:
cloudPath- The desired cloud path of the filecloudFilename- The desired cloud filename of the fileshareable- True if the file is shareable.replaceIfExists- Whether to replace file if it existslocalPath- The path and filename of the local filecallback- The method to be invoked when the server response is received- Returns:
- False if the file does not exist at the localPath Significant error codes: 40429 - File maximum file size exceeded 40430 - File exists, replaceIfExists not set
-
listUserFiles
List all user files- Parameters:
callback- The method to be invoked when the server response is received
-
listUserFiles
List user files from the given cloud path- Parameters:
cloudPath- File pathrecurse- Whether to recurse into sub-directoriescallback- The method to be invoked when the server response is received
-
deleteUserFile
Deletes a single user file.- Parameters:
cloudPath- File pathcloudFilename- name of filecallback- The method to be invoked when the server response is received Significant error codes: 40431 - Cloud storage service error 40432 - File does not exist
-
deleteUserFiles
Delete multiple user files- Parameters:
cloudPath- File pathrecurse- Whether to recurse into sub-directoriescallback- The method to be invoked when the server response is received
-
getCDNUrl
Returns the CDN url for a file object- Parameters:
cloudPath- File pathcloudFileName- Name of filecallback- The method to be invoked when the server response is received
-
cancelUpload
Method cancels an upload. If an IFileUploadCallback has been registered with the BrainCloudClient class, the fileUploadFailed callback method will be called once the upload has been canceled.- Parameters:
uploadId- The id of the upload
-
getUploadProgress
Returns the progress of the given upload from 0.0 to 1.0 or -1 if upload not found.- Parameters:
uploadId- The id of the upload- Returns:
- A progress from 0.0 to 1.0 or -1 if upload not found.
-
getUploadBytesTransferred
Returns the number of bytes uploaded or -1 if upload not found.- Parameters:
uploadId- The id of the upload- Returns:
- The number of bytes uploaded or -1 if upload not found.
-
getUploadTotalBytesToTransfer
Returns the total number of bytes that will be uploaded or -1 if upload not found.- Parameters:
uploadId- The id of the upload- Returns:
- The total number of bytes that will be uploaded or -1 if upload not found.
-