类 BosObject
- java.lang.Object
-
- com.baidubce.services.bos.model.BosObject
-
- 所有已实现的接口:
Closeable,AutoCloseable
public class BosObject extends Object implements Closeable
Represents an object stored in Baidu Bos. This object contains the data content and the object metadata stored by Baidu Bos, such as content type, content length, etc.
-
-
构造器概要
构造器 构造器 说明 BosObject()
-
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 voidclose()StringgetBucketName()Gets the name of the bucket in which this object is contained.StringgetKey()Gets the key under which this object is stored.BosObjectInputStreamgetObjectContent()Gets an input stream containing the contents of this object.ObjectMetadatagetObjectMetadata()Gets the metadata stored by Bos for this object.voidsetBucketName(String bucketName)Sets the name of the bucket in which this object is contained.voidsetKey(String key)Sets the key under which this object is stored.voidsetObjectContent(BosObjectInputStream objectContent)Sets the input stream containing this object's contents.voidsetObjectMetadata(ObjectMetadata objectMetadata)Sets the object metadata for this object.StringtoString()
-
-
-
方法详细资料
-
getBucketName
public String getBucketName()
Gets the name of the bucket in which this object is contained.- 返回:
- The name of the bucket in which this object is contained.
-
setBucketName
public void setBucketName(String bucketName)
Sets the name of the bucket in which this object is contained.- 参数:
bucketName- The name of the bucket containing this object.
-
getKey
public String getKey()
Gets the key under which this object is stored.- 返回:
- The key under which this object is stored.
-
setKey
public void setKey(String key)
Sets the key under which this object is stored.- 参数:
key- The key under which this object is stored.
-
getObjectMetadata
public ObjectMetadata getObjectMetadata()
Gets the metadata stored by Bos for this object. The ObjectMetadata object includes any custom user metadata supplied by the caller when the object was uploaded, as well as HTTP metadata such as content length and content type.- 返回:
- The metadata stored by Baidu Bos for this object.
-
setObjectMetadata
public void setObjectMetadata(ObjectMetadata objectMetadata)
Sets the object metadata for this object.- 参数:
objectMetadata- The new metadata to set for this object in memory.
-
getObjectContent
public BosObjectInputStream getObjectContent()
Gets an input stream containing the contents of this object. Callers should close this input stream as soon as possible, because the object contents aren't buffered in memory and stream directly from Baidu Bos.- 返回:
- An input stream containing the contents of this object.
-
setObjectContent
public void setObjectContent(BosObjectInputStream objectContent)
Sets the input stream containing this object's contents.- 参数:
objectContent- The input stream containing this object's contents.
-
close
public void close() throws IOException- 指定者:
close在接口中AutoCloseable- 指定者:
close在接口中Closeable- 抛出:
IOException
-
-