Package org.apache.sling.thumbnails
Interface RenditionSupport
-
@ProviderType public interface RenditionSupport
Service for interacting with renditions
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description @Nullable org.apache.sling.api.resource.Resource
getRendition(@NotNull org.apache.sling.api.resource.Resource file, @NotNull String renditionName)
Retrieves the rendition with the specified rendition name, if one exists.@Nullable InputStream
getRenditionContent(@NotNull org.apache.sling.api.resource.Resource file, @NotNull String renditionName)
Retrieves the inputstream of the data of a rendition with the specified rendition name, if one exists.@NotNull List<org.apache.sling.api.resource.Resource>
listRenditions(@NotNull org.apache.sling.api.resource.Resource file)
Retrieves all of the renditions for the specified file.boolean
renditionExists(@NotNull org.apache.sling.api.resource.Resource file, @NotNull String renditionName)
Returns true if the requested rendition exists for the specified file.void
setRendition(@NotNull org.apache.sling.api.resource.Resource file, @NotNull String renditionName, @NotNull InputStream baos)
Sets the content of the rendition, overriding any existing contentboolean
supportsRenditions(@NotNull org.apache.sling.api.resource.Resource file)
Checks if the file supports renditions, e.g.
-
-
-
Method Detail
-
getRendition
@Nullable @Nullable org.apache.sling.api.resource.Resource getRendition(@NotNull @NotNull org.apache.sling.api.resource.Resource file, @NotNull @NotNull String renditionName)
Retrieves the rendition with the specified rendition name, if one exists.- Parameters:
file
- the file from which to retrieve the renditionrenditionName
- the rendition to retrieve- Returns:
- the rendition resource or null
-
getRenditionContent
@Nullable @Nullable InputStream getRenditionContent(@NotNull @NotNull org.apache.sling.api.resource.Resource file, @NotNull @NotNull String renditionName)
Retrieves the inputstream of the data of a rendition with the specified rendition name, if one exists.- Parameters:
file
- the file from which to retrieve the renditionrenditionName
- the rendition to retrieve- Returns:
- the rendition contents or null
-
listRenditions
@NotNull @NotNull List<org.apache.sling.api.resource.Resource> listRenditions(@NotNull @NotNull org.apache.sling.api.resource.Resource file)
Retrieves all of the renditions for the specified file.- Parameters:
file
- the file from which to retrieve the renditions- Returns:
- the renditions
-
renditionExists
boolean renditionExists(@NotNull @NotNull org.apache.sling.api.resource.Resource file, @NotNull @NotNull String renditionName)
Returns true if the requested rendition exists for the specified file.- Parameters:
file
- the file to checkrenditionName
- the rendition name to check (including extension)- Returns:
- true if the rendition exists, false otherwise
-
supportsRenditions
boolean supportsRenditions(@NotNull @NotNull org.apache.sling.api.resource.Resource file)
Checks if the file supports renditions, e.g. it's defined as a Persistable Type.- Parameters:
file
- the file to check- Returns:
- true if the file supports renditons, false otherwise
-
setRendition
void setRendition(@NotNull @NotNull org.apache.sling.api.resource.Resource file, @NotNull @NotNull String renditionName, @NotNull @NotNull InputStream baos) throws org.apache.sling.api.resource.PersistenceException
Sets the content of the rendition, overriding any existing content- Parameters:
file
-renditionName
-baos
-- Throws:
org.apache.sling.api.resource.PersistenceException
-
-