|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Resource
Interface representing a binary resource, like an image or a file.
Method Summary | |
---|---|
byte[] |
getBytes()
Returns the contents of the resource contained within this component as a byte array. |
java.io.InputStream |
getInputStream()
Returns the contents of the resource contained within this component as a input stream. |
java.lang.String |
getMimeType()
Returns the mime-type of the resource file. |
java.lang.String |
getResourceName()
Returns the name of the resource contained within this component. |
java.lang.String |
getResourceURL()
Returns the server relative URL or Piece of Content (PoC) URI to the resource. |
long |
getSize()
Returns the size in bytes of the file contained within this component. |
void |
removeResource()
Removes the resource file contained within this component. |
void |
setDeliverableOverCachingNetworkSupport(boolean deliveryOverCachingNetwork)
Sets a flag indicating the asset should be delivery over a caching network if available. |
void |
setResource(java.lang.String resourceName,
byte[] resourceBytes)
Sets the resource file contained within this component. |
void |
setResource(java.lang.String resourceName,
java.io.File resourceFile)
Sets the resource file contained within this component. |
boolean |
supportsDeliveryOverCachingNetwork()
Returns true if the asset can be delivery over a caching network if available. |
Method Detail |
---|
java.lang.String getResourceName() throws AuthorizationException, PropertyRetrievalException
Returns null if a resource name has not been specified.
AuthorizationException
- if the user does not have access to the resource
PropertyRetrievalException
- if the resource name cannot be retrievedbyte[] getBytes() throws AuthorizationException, PropertyRetrievalException
May return an empty byte array if the byte content could not be retrieved.
AuthorizationException
- if the user does not have access to the file
PropertyRetrievalException
- if the file cannot be retrieved or is externally managedjava.io.InputStream getInputStream() throws AuthorizationException, PropertyRetrievalException
Returns an empty byte array if no file has been set or the byte content could not be retrieved.
AuthorizationException
- if the user does not have access to the file
PropertyRetrievalException
- if the file cannot be retrieved or is externally managedvoid setResource(java.lang.String resourceName, byte[] resourceBytes) throws OperationFailedException
This method does not accept null arguments. Passing a
null argument into this method will result in a
NullPointerException
.
resourceName
- the filename of the resource fileresourceBytes
- the content of the resource file as a byte array
java.lang.NullPointerException
- if either of the arguments resourceName or
resource are null
OperationFailedException
- if the resource file could not be setvoid setResource(java.lang.String resourceName, java.io.File resourceFile) throws OperationFailedException
This method does not accept null arguments. Passing a
null argument into this method will result in a
NullPointerException
.
resourceName
- the filename of the resource fileresourceFile
- the contents of the resource as a file on the file system
java.lang.NullPointerException
- if either of the arguments resourceName or
resource are null
OperationFailedException
- if the resource file could not be setvoid removeResource() throws OperationFailedException
OperationFailedException
- if an error occurred removing the resource file.java.lang.String getMimeType()
Returns null if no resource file has been set.
long getSize() throws AuthorizationException, PropertyRetrievalException
Returns -1 if a file has not been specified.
AuthorizationException
- if the user does not have access to the file
PropertyRetrievalException
- if the file cannot be retrievedjava.lang.String getResourceURL()
Returns null if no resource has been set.
boolean supportsDeliveryOverCachingNetwork()
void setDeliverableOverCachingNetworkSupport(boolean deliveryOverCachingNetwork)
deliveryOverCachingNetwork
- should asset be delivered via caching network?
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |