Package com.adobe.granite.asset.api
Interface Rendition
-
- All Known Subinterfaces:
BinaryRendition
@ConsumerType public interface Rendition extends Resource
Renditionis a read only representation of a particular rendition of anAsset.Rendition is an extension of a Sling Resource, therefore its adaptable.
Rendition is created by
Asset.setRendition(String, java.io.InputStream, java.util.Map)and can be retrieved either viaAsset.getRendition(String)or by adapting a renditionResourceto aRenditiontype.eg: // to create a rendition AssetManager assetManager = resolver.adaptTo(AssetManager.class); Asset asset = assetManager.getAsset("/path/to/asset/document.pdf"); asset.setRendition("thumbnail.jpg", java.io.InputStream, java.util.Map); // to get rendition Rendition rendition = asset.getRendition("thumbnail.jpg"); // to get rendition by adapting Rendition rendition = resource.adaptTo(Rendition.class);
-
-
Field Summary
-
Fields inherited from interface org.apache.sling.api.resource.Resource
RESOURCE_TYPE_NON_EXISTING
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.StringgetMimeType()Returns the mime type of the rendition's binary.longgetSize()Returns the size in bytes of the rendition's binary.java.io.InputStreamgetStream()Returns theInputStreamrepresenting the binary of this rendition.-
Methods inherited from interface org.apache.sling.api.resource.Resource
getChild, getChildren, getName, getParent, getPath, getResourceMetadata, getResourceResolver, getResourceSuperType, getResourceType, getValueMap, hasChildren, isResourceType, listChildren
-
-
-
-
Method Detail
-
getMimeType
java.lang.String getMimeType()
Returns the mime type of the rendition's binary.- Returns:
- the mime type
-
getSize
long getSize()
Returns the size in bytes of the rendition's binary.- Returns:
- The size.
-
getStream
java.io.InputStream getStream()
Returns theInputStreamrepresenting the binary of this rendition.- Returns:
- The input stream of the rendition's binary, or
nullif the binary is not found. - Throws:
AssetIOException- if stream cannot be read
-
-