public abstract class StorageObject extends ExternalObject
Modifier | Constructor and Description |
---|---|
protected |
StorageObject(java.lang.String uri,
java.lang.String name,
java.lang.String type,
java.lang.String encoding,
java.lang.String date,
long length)
Create a
StorageObject . |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object obj) |
java.util.Map<java.lang.String,java.lang.String> |
getCustomMetadata()
This method return unmodifiable copy of metadata.
|
java.lang.String |
getDate()
Get the date and time the content was created or last modified in cloud
storage.
|
java.lang.String |
getEncoding()
Get the compression scheme of the content.
|
java.io.InputStream |
getInputStream()
Called by the library to obtain the input stream when uploading content
|
long |
getLength()
Get the length of the content in bytes.
|
java.lang.String |
getName()
Get the the name of this object in the storage cloud.
|
java.io.OutputStream |
getOutputStream()
Called by the library to obtain the output stream when downloading content
|
java.lang.String |
getType()
Get the mime-type of the content.
|
int |
hashCode() |
protected void |
setAttributes(java.lang.String date,
long length)
Used internally by the client library to update fields after upload.
|
void |
setCustomMetadata(java.lang.String key,
java.lang.String value)
Sets the metadata for the StorageObject.
|
void |
setInputStream(java.io.InputStream inputStream)
Set an input stream for content to be uploaded.
|
void |
setOutputStream(java.io.OutputStream outputStream)
Set an output stream for content to be downloaded.
|
abstract void |
sync()
Synchronize content with the Storage Cloud Service.
|
getURI
protected StorageObject(java.lang.String uri, java.lang.String name, java.lang.String type, java.lang.String encoding, java.lang.String date, long length)
StorageObject
.uri
- the full URL of the object in the Storage Cloudname
- name of the object used in the Storage Cloudtype
- type of the object, or null
if noneencoding
- encoding of the object, or null
if nonedate
- last-modified date of the objectlength
- length of the objectpublic java.lang.String getName()
public java.lang.String getType()
public java.lang.String getEncoding()
null
if the content is not compressedpublic long getLength()
-1
if unknownpublic java.lang.String getDate()
null
if the content has not been uploaded.
The date and time stamp format is ISO 8601.null
if the
content has not been uploaded.public java.io.InputStream getInputStream()
public void setInputStream(java.io.InputStream inputStream)
inputStream
parameter is not null, the output stream will be set to null.inputStream
- A stream from which the content will be readpublic java.io.OutputStream getOutputStream()
public void setOutputStream(java.io.OutputStream outputStream)
outputStream
parameter is not null
, the input stream will be set to
null
.outputStream
- A stream to which the content will be writtenpublic abstract void sync() throws java.io.IOException, java.security.GeneralSecurityException
java.io.IOException
- if there is an IOException
raised by the runtime,
or a failure reported by the storage cloudjava.security.GeneralSecurityException
- if there is an exception establishing a secure connection to the storage cloudjava.lang.IllegalArgumentException
- if the StorageObject
does not return an InputStream
or OutputStream
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object
protected void setAttributes(java.lang.String date, long length)
date
- the last-modified date for the object in the Storage Cloudlength
- the length for the object in the Storage Cloudpublic void setCustomMetadata(java.lang.String key, java.lang.String value)
key
- The metadata keyvalue
- The metadata valuejava.lang.IllegalArgumentException
- if either the key or value is empty or null
public java.util.Map<java.lang.String,java.lang.String> getCustomMetadata()