public class UcloudStorageClient extends Object
| Constructor and Description |
|---|
UcloudStorageClient(String storageUser,
String storagePass)
Creates a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
createStorageContainer(String containerName)
Creates a storage container named as given name.
|
boolean |
deleteStorageContainer(String containerName)
Deletes a storage container named as given container name.
|
boolean |
deleteStorageObject(String containerName,
String objectName)
Deletes an object.
|
Integer |
getConnectTimeout()
Returns connect timeout.
|
String |
getFirstHeaderValue(String headerName) |
Map<String,List<String>> |
getHeaderFields()
Returns last HTTP response header fields.
|
List<String> |
getHeaderValues(String headerName) |
Integer |
getReadTimeout()
Return read timeout.
|
int |
getResponseCode()
Returns last HTTP response status code.
|
String |
getResponseMessage()
Returns last HTTP response reason phrase.
|
StorageAccount |
readStorageAccount()
Retrieves a storage account.
|
StorageContainer |
readStorageContainer(String containerName)
Retrieves a storage container whose name is mapped to given container
name.
|
boolean |
readStorageContainers(Map<String,Object> queryParameters,
Collection<? super StorageContainer> storageContainers)
Retrieves storage containers.
|
boolean |
readStorageContent(String containerName,
String objectName,
ContentConsumer contentConsumer)
Reads the content of a storage object.
|
StorageObject |
readStorageObject(String containerName,
String objectName) |
boolean |
readStorageObjects(String containerName,
Map<String,Object> queryParameters,
Collection<? super StorageObject> storageObjects)
Reads objects information of a container.
|
void |
setConnectTimeout(Integer connectTimeout)
Sets connect timeout.
|
void |
setReadTimeout(Integer readTimeout)
Sets read timeout.
|
boolean |
updateStorageContent(String containerName,
String objectName,
ContentProducer contentProducer)
Updates or creates an storage content.
|
boolean |
updateStorageContent(String containerName,
String objectName,
String contentType,
byte[] contentData)
Updates an object's content.
|
boolean |
updateStorageContent(String containerName,
String objectName,
String contentType,
long contentLength,
InputStream contentData)
Updates an storage object's content.
|
public StorageAccount readStorageAccount() throws IOException
null if failed.IOException - if an I/O error occurs.public boolean readStorageContainers(Map<String,Object> queryParameters, Collection<? super StorageContainer> storageContainers) throws IOException
queryParameters - query parameters; null is allowedstorageContainers - the collection to which results are addedtrue if succeeded; false otherwiseIOException - if an I/O error occurs.public boolean createStorageContainer(String containerName) throws IOException
containerName - the container nameIOException - if an I/O error occurs.public StorageContainer readStorageContainer(String containerName) throws IOException
containerName - the container namenull if not found or
failedIOException - if an I/O error occurs.public boolean deleteStorageContainer(String containerName) throws IOException
containerName - the name of the storage container to deletetrue if succeeded; false otherwiseIOException - if an I/O error occurs.public boolean readStorageObjects(String containerName, Map<String,Object> queryParameters, Collection<? super StorageObject> storageObjects) throws IOException
containerName - the container namequeryParameters - query parameters; null is allowedstorageObjects - the collection to which all results are addedtrue if succeeded; false otherwiseIOException - if an I/O error occurspublic StorageObject readStorageObject(String containerName, String objectName) throws IOException
IOExceptionpublic boolean deleteStorageObject(String containerName, String objectName) throws IOException
containerName - the container nameobjectName - the object nametrue if succeeded; false otherwiseIOException - if an I/O error occurs.public boolean updateStorageContent(String containerName, String objectName, ContentProducer contentProducer) throws IOException
containerName - container nameobjectName - object namecontentProducer - content producerIOException - if an I/O error occurspublic boolean updateStorageContent(String containerName, String objectName, String contentType, long contentLength, InputStream contentData) throws IOException
containerName - container nameobjectName - object namecontentType - content type; null for unknowncontentLength - content length; -1L for unknowncontentData - content dataIOException - if an I/O error occurspublic boolean updateStorageContent(String containerName, String objectName, String contentType, byte[] contentData) throws IOException
containerName - container nameobjectName - object namecontentType - content type; null for unknowncontentData - content dataIOException - if an I/O error occurspublic boolean readStorageContent(String containerName, String objectName, ContentConsumer contentConsumer) throws IOException
containerName - the container nameobjectName - the object namecontentConsumer - the content consumerIOException - if an I/O error occurspublic Integer getConnectTimeout()
public void setConnectTimeout(Integer connectTimeout)
connectTimeout - connect timeoutpublic Integer getReadTimeout()
public void setReadTimeout(Integer readTimeout)
readTimeout - read timeoutpublic int getResponseCode()
public String getResponseMessage()
public Map<String,List<String>> getHeaderFields()
Copyright © 2011-2013. All Rights Reserved.