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

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

The newest version!
package com.day.cq.dam.api;

import java.io.InputStream;

import javax.jcr.Binary;

import org.apache.sling.api.resource.Resource;
import org.apache.sling.api.resource.ValueMap;
import org.osgi.annotation.versioning.ProviderType;

/**
 * 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.
 */
@ProviderType
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 the Binary of this rendition. * * @return The rendition's binary, or null if the binary is not found. */ Binary getBinary(); /** * Returns this rendition's parent Asset. * * @return The {@link Asset} this rendition belongs to. */ Asset getAsset(); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy