public class ServiceUtils extends Object
| 限定符和类型 | 类和说明 |
|---|---|
static interface |
ServiceUtils.RetryableCOSDownloadTask
Interface for the task of downloading object from COS to a specific file,
enabling one-time retry mechanism after integrity check failure
on the downloaded file.
|
| 限定符和类型 | 字段和说明 |
|---|---|
static boolean |
APPEND_MODE |
static boolean |
OVERWRITE_MODE |
| 构造器和说明 |
|---|
ServiceUtils() |
| 限定符和类型 | 方法和说明 |
|---|---|
static void |
downloadObjectToFile(COSObject cosObject,
File destinationFile,
boolean performIntegrityCheck,
boolean appendData)
Downloads an COSObject, as returned from
COSClient#getObject(com.qcloud.cos.model.GetObjectRequest),
to the specified file. |
static void |
downloadToFile(COSObject cosObject,
File dstfile,
boolean performIntegrityCheck,
boolean appendData,
long expectedFileLength)
Same as
downloadObjectToFile(COSObject, File, boolean, boolean)
but has an additional expected file length parameter for integrity
checking purposes. |
static COSObject |
retryableDownloadCOSObjectToFile(File file,
ServiceUtils.RetryableCOSDownloadTask retryableCOSDownloadTask,
boolean appendData)
Gets an object stored in COS and downloads it into the specified file.
|
public static final boolean APPEND_MODE
public static final boolean OVERWRITE_MODE
public static void downloadToFile(COSObject cosObject, File dstfile, boolean performIntegrityCheck, boolean appendData, long expectedFileLength)
downloadObjectToFile(COSObject, File, boolean, boolean)
but has an additional expected file length parameter for integrity
checking purposes.expectedFileLength - applicable only when appendData is true; the expected length
of the file to append to.public static void downloadObjectToFile(COSObject cosObject, File destinationFile, boolean performIntegrityCheck, boolean appendData)
COSClient#getObject(com.qcloud.cos.model.GetObjectRequest),
to the specified file.cosObject - The COSObject containing a reference to an InputStream
containing the object's data.destinationFile - The file to store the object's data in.performIntegrityCheck - Boolean valuable to indicate whether to perform integrity checkappendData - appends the data to end of the file.public static COSObject retryableDownloadCOSObjectToFile(File file, ServiceUtils.RetryableCOSDownloadTask retryableCOSDownloadTask, boolean appendData)
file - The file to store the object's data in.retryableCOSDownloadTask - The implementation of SafeCOSDownloadTask interface which allows user to
get access to all the visible variables at the calling site of this method.Copyright © 2017. All rights reserved.