public class S3Object extends Object implements Closeable
S3ObjectMetadata
Constructor and Description |
---|
S3Object() |
Modifier and Type | Method and Description |
---|---|
void |
close()
Releases any underlying system resources.
|
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.
|
com.amazonaws.services.s3.model.S3ObjectInputStream |
getObjectContent()
Gets the input stream containing the contents of this object.
|
S3ObjectMetadata |
getObjectMetadata()
Gets the metadata stored by Amazon S3 for this object.
|
String |
getRedirectLocation()
Gets the redirect location for this object.
|
boolean |
isRequesterCharged()
Returns true if the user is charged for downloading the object from an Requester Pays Bucket; else false.
|
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(com.amazonaws.services.s3.model.S3ObjectInputStream objectContent)
Sets the input stream containing this object's contents.
|
void |
setObjectMetadata(S3ObjectMetadata metadata)
Sets the object metadata for this object.
|
void |
setRedirectLocation(String redirectLocation)
Sets the redirect location for this object.
|
void |
setRequesterCharged(boolean isRequesterCharged)
Used for downloading an Amazon S3 Object from a Requester Pays Bucket.
|
String |
toString() |
public S3ObjectMetadata getObjectMetadata()
S3ObjectMetadata
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.getObjectContent()
public void setObjectMetadata(S3ObjectMetadata metadata)
org.mule.module.s3.S3Connector#copyObject(String, String, String, String, String, CannedAccessControlList, StorageClass, Map, Date, Date, String)
to copy the object
to a new (or the same location) and specify new object metadata then.metadata
- The new metadata to set for this object in memory.public com.amazonaws.services.s3.model.S3ObjectInputStream getObjectContent()
Note: The method is a simple getter and does not actually create a stream. If you retrieve an S3Object, you should close this input stream as soon as possible, because the object contents aren't buffered in memory and stream directly from Amazon S3. Further, failure to close this stream can cause the request pool to become blocked.
getObjectMetadata()
,
setObjectContent(S3ObjectInputStream)
public void setObjectContent(com.amazonaws.services.s3.model.S3ObjectInputStream objectContent)
objectContent
- The input stream containing this object's contents.getObjectContent()
public String getBucketName()
setBucketName(String)
public void setBucketName(String bucketName)
bucketName
- The name of the bucket containing this object.getBucketName()
public String getKey()
setKey(String)
public void setKey(String key)
key
- The key under which this object is stored.getKey()
public String getRedirectLocation()
public void setRedirectLocation(String redirectLocation)
redirectLocation
- the redirect location for that object.public String toString()
toString
in class Object
Object.toString()
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
- if an I/O error occurspublic boolean isRequesterCharged()
public void setRequesterCharged(boolean isRequesterCharged)
isRequesterCharged
- Indicates requester is charged for this operation.Copyright © 2010–2017. All rights reserved.