Interface Rendition

  • All Superinterfaces:
    Adaptable, Resource
    All Known Subinterfaces:
    BinaryRendition

    @ConsumerType
    public interface Rendition
    extends Resource
    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);
     
    • 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 the InputStream representing the binary of this rendition.
        Returns:
        The input stream of the rendition's binary, or null if the binary is not found.
        Throws:
        AssetIOException - if stream cannot be read