Package com.adobe.cq.dam.download.api
Interface DownloadFile
-
@ProviderType public interface DownloadFile
Represents a repository file whose binary contents can be included in a download artifact. This is the result of converting a
DownloadTarget
into one or more files by aDownloadTargetProcessor
.In addition to some common values, the interface provides the ability to specify additional parameters in the form of name value pairs.
- See Also:
DownloadService
,DownloadTarget
,DownloadTargetProcessor
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.net.URI
getBinaryURI()
Retrieves a URI to the file's binary.<T> T
getParameter(java.lang.String parameterName, java.lang.Class<T> clazz)
Retrieves one of the file's parameters by name.<T> T
getParameter(java.lang.String parameterName, T defaultValue)
Retrieves one of the file's parameters by name.java.lang.String[]
getParameterNames()
Retrieves the names of all parameters included in the file.java.util.Optional<java.lang.Long>
getSize()
Retrieves the size of the file, in bytes.
-
-
-
Method Detail
-
getSize
java.util.Optional<java.lang.Long> getSize()
Retrieves the size of the file, in bytes.- Returns:
- Byte size.
-
getBinaryURI
java.net.URI getBinaryURI()
Retrieves a URI to the file's binary. Should be accessible to the service being used to generate the archive.- Returns:
- URI to a binary.
-
getParameter
<T> T getParameter(java.lang.String parameterName, java.lang.Class<T> clazz)
Retrieves one of the file's parameters by name. The value will be converted to the specified type.- Type Parameters:
T
- Target type for the parameter value.- Parameters:
parameterName
- The name of the parameter whose value to retrieve.clazz
- The type to which that the parameter's value will be converted.- Returns:
- The given parameter's value.
-
getParameter
<T> T getParameter(java.lang.String parameterName, T defaultValue)
Retrieves one of the file's parameters by name. If the parameter doesn't have a value then the method will return the given default value instead. The parameter value will be converted to the specified type.- Type Parameters:
T
- Target type for the parameter value.- Parameters:
parameterName
- The name of the parameter whose value to retrieve.defaultValue
- Value to return if the parameter has no value.- Returns:
- The given parameter's value, or the given defalt value.
-
getParameterNames
java.lang.String[] getParameterNames()
Retrieves the names of all parameters included in the file.- Returns:
- Parameter names.
-
-