All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.day.cq.dam.api.Rendition Maven / Gradle / Ivy

package com.day.cq.dam.api;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;

import java.io.InputStream;

/**
 * The Rendition interface specifies the handling of an {@link Asset}'s rendition. Renditions are based on
 * the renditions found in the asset's rendition folder (./jcr:content/renditions). Such renditions are based on
 * nodes of type nt:file.
 */
public interface Rendition extends Resource {

    /**
     * Returns the mime type of the rendition's binary, as denoted by its jcr:mimeType property.
     *
     * @return The mime type of the rendition's binary.
     */
    String getMimeType();

    /**
     * Returns the name of the rendition. The name corresponds to the node name underlying the rendition, e.g.
     * ./jcr:content/renditions/myrendition gives a name of myrendition
     *
     * @return The name of the rendition.
     */
    String getName();

    /**
     * Returns the path of the rendition, e.g. /content/dam/myasset/jcr:content/renditions/myrendition.
     *
     * @return The path of the rendition.
     */
    String getPath();

    /**
     * Returns the {@link ValueMap} of the rendition's underlying ./jcr:content node.
     *
     * @return The content properties.
     */
    ValueMap getProperties();

    /**
     * Returns the size in bytes of the rendition's binary.
     *
     * @return The size.
     */
    long getSize();

    /**
     * Returns the InputStream representing the binary of this rendition. Alternatively the stream can be
     * obtained by adapting the rendition:
     * 
     *    ...
     *    final Rendition rendition = asset.getRendition("myrendition");
     *    final InputStream stream = rendition.adaptTo(InputStream.class);
     *    ...
     * 
* * @return The input stream of the rendition's binary, or null if the binary is not found. */ InputStream getStream(); /** * Returns this rendition's parent Asset. * * @return The {@link Asset} this rendition belongs to. */ Asset getAsset(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy