public class FileTransferManager extends AbstractFileTransferManager
It provides APIs to upload and download single or multiple files in a simple but efficient manner with high throughput.
The utility uses multiple threads to upload simultaneously multiple segments for a large file upload. It manages the required resources such as connections to the cloud service and threads.
Exceptions
The methods in this interface may throw following exceptions:
ClientException
- if the client API failed to process the request or the response from the server.ServiceException
- if the storage cloud service returned an error or unexpected response.InvalidContainerName
if the container name is invalidInvalidObjectName
if the object name is invalidModifier and Type | Method and Description |
---|---|
static FileTransferManager |
getDefaultFileTransferManager(FileTransferAuth fileTransferAuth)
Factory method to create FileTransferManager object.
|
static FileTransferManager |
getDefaultFileTransferManager(FileTransferAuth fileTransferAuth, FileTransferManagerConfig managerConfig)
Factory method to create FileTransferManager object.
|
ArchiveFileUploadResult |
uploadArchiveFile(String containerName, String objectPrefix, File file, ArchiveFileFormat archiveFileFormat)
Uploads an archive file to storage cloud and extracts it in the specified container.
|
TransferTask<ArchiveFileUploadResult> |
uploadArchiveFileAsync(String containerName, String objectPrefix, File file, ArchiveFileFormat archiveFileFormat)
This is an asynchronous version of method
uploadArchiveFile(String, String, File, ArchiveFileFormat) . |
MultiArchiveFileUploadResult |
uploadMultipleArchiveFiles(String containerName, List<ArchiveFileUploadConfig> archiveFileUploadConfigs)
Uploads an archive file to storage cloud and extracts it in the specified container.
|
TransferTask<MultiArchiveFileUploadResult> |
uploadMultipleArchiveFilesAsync(String containerName, List<ArchiveFileUploadConfig> archiveFileUploadConfigs, ArchiveFileUploadProgressListener progressListener)
Initiates an upload and extraction of multiple archive files to the specified storage cloud container.
|
containerExists, copyObject, copyObject, createContainer, createContainer, createSSEEnabledContainer, deleteContainer, deleteObject, deleteObjects, download, downloadAsync, downloadDirectory, downloadDirectoryAsync, downloadMultipleFiles, downloadMultipleFilesAsync, downloadStream, forceDeleteContainer, getAccount, getApiVersion, getContainer, getContainerReplicationPolicy, getFileTransferManagerConfig, getManagementThreadPool, getObject, getObjectRestoreJob, getReplicationPolicies, getRequestCount, getSession, getThreadPool, listContainers, listContainers, listObjects, listObjects, objectExists, restoreObject, setContainerReplicationPolicy, setFileTransferAuth, setFileTransferManagerConfig, setObjectMetadata, shutdown, shutdownNow, updateAccountMetadata, updateContainerMetadata, updateObjectMetadata, upload, uploadAsync, uploadDirectory, uploadDirectoryAsync, uploadMultipleFiles, uploadMultipleFilesAsync, uploadSegmentedStream, uploadStream
public static FileTransferManager getDefaultFileTransferManager(FileTransferAuth fileTransferAuth) throws ClientException, ServiceException
This returns a singleton instance of this class.
fileTransferAuth
- Authentication credentials for transfer.ClientException
ServiceException
public static FileTransferManager getDefaultFileTransferManager(FileTransferAuth fileTransferAuth, FileTransferManagerConfig managerConfig) throws ClientException, ServiceException
This returns a singleton instance of this class.
fileTransferAuth
- Authentication credentials for transfer.managerConfig
- Configuration information for the transfer manager.ClientException
ServiceException
public ArchiveFileUploadResult uploadArchiveFile(String containerName, String objectPrefix, File file, ArchiveFileFormat archiveFileFormat) throws ClientException, ServiceException
The API returns after the upload is completed or throws an exception if there is any error during upload or extract operation.
The archive file format must be one of the formats represented by ArchiveFileFormat
.
containerName
- container name. If container does not exist, it will be created. Only standard storage container types are supported.objectPrefix
- Prefix for the objects created for the extracted files from the archive file. May be null
.file
- archive file to be uploadedarchiveFileFormat
- archive file format. May be null. When null, then the API will attempt to detect the file format by probing the file or finding the file extension.FileSizeTooBig
- if the file to be uploaded is too big ( more than 5GiB).InvalidSourceFile
- if the archive file is invalidInvalidArchiveFileFormat
- if archive file format is invalid or if the format is not specified and it could not be detected.ClientException
ServiceException
public TransferTask<ArchiveFileUploadResult> uploadArchiveFileAsync(String containerName, String objectPrefix, File file, ArchiveFileFormat archiveFileFormat) throws ClientException, ServiceException
This is an asynchronous version of method uploadArchiveFile(String, String, File, ArchiveFileFormat)
. Refer to that method for details about behavior and exceptions thrown. The exceptions thrown by this asynchronous API could be recovered from the cause of exceptions thrown by oracle.cloudstorage.ftm.model.ArchiveFileUploadResult#getResult()
.
ClientException
ServiceException
public MultiArchiveFileUploadResult uploadMultipleArchiveFiles(String containerName, List<ArchiveFileUploadConfig> archiveFileUploadConfigs) throws ClientException, ServiceException
containerName
- container name. If container does not exist, it will be created. Only standard storage container types are supported.archiveFileUploadConfigs
- list of archive file upload configurationsClientException
ServiceException
public TransferTask<MultiArchiveFileUploadResult> uploadMultipleArchiveFilesAsync(String containerName, List<ArchiveFileUploadConfig> archiveFileUploadConfigs, ArchiveFileUploadProgressListener progressListener) throws ClientException, ServiceException
containerName
- container name. If container does not exist, it will be created. Only standard storage container types are supported.archiveFileUploadConfigs
- list of archive file upload configurationsprogressListener
- listener object for upload progressClientException
ServiceException