Package com.adobe.granite.asset.api
Interface Rendition
- All Known Subinterfaces:
BinaryRendition
Rendition is a read only representation of a particular rendition of an Asset.
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 via Asset.getRendition(String) or by adapting a rendition Resource
to a Rendition type.
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
Modifier and TypeMethodDescriptionReturns the mime type of the rendition's binary.longgetSize()Returns the size in bytes of the rendition's binary.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 Details
-
getMimeType
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
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
-