com.baidubce.services.bos.model
Class BosObject

java.lang.Object
  extended by com.baidubce.services.bos.model.BosObject
All Implemented Interfaces:
Closeable

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.


Constructor Summary
BosObject()
           
 
Method Summary
 void close()
           
 String getBucketName()
          Gets the name of the bucket in which this object is contained.
 String getKey()
          Gets the key under which this object is stored.
 BosObjectInputStream getObjectContent()
          Gets an input stream containing the contents of this object.
 ObjectMetadata getObjectMetadata()
          Gets the metadata stored by Bos for this object.
 void setBucketName(String bucketName)
          Sets the name of the bucket in which this object is contained.
 void setKey(String key)
          Sets the key under which this object is stored.
 void setObjectContent(BosObjectInputStream objectContent)
          Sets the input stream containing this object's contents.
 void setObjectMetadata(ObjectMetadata objectMetadata)
          Sets the object metadata for this object.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BosObject

public BosObject()
Method Detail

getBucketName

public String getBucketName()
Gets the name of the bucket in which this object is contained.

Returns:
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.

Parameters:
bucketName - The name of the bucket containing this object.

getKey

public String getKey()
Gets the key under which this object is stored.

Returns:
The key under which this object is stored.

setKey

public void setKey(String key)
Sets the key under which this object is stored.

Parameters:
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.

Returns:
The metadata stored by Baidu Bos for this object.

setObjectMetadata

public void setObjectMetadata(ObjectMetadata objectMetadata)
Sets the object metadata for this object.

Parameters:
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.

Returns:
An input stream containing the contents of this object.

setObjectContent

public void setObjectContent(BosObjectInputStream objectContent)
Sets the input stream containing this object's contents.

Parameters:
objectContent - The input stream containing this object's contents.

toString

public String toString()
Overrides:
toString in class Object

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Throws:
IOException


Copyright © 2018. All rights reserved.