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 a DownloadTargetProcessor.

In addition to some common values, the interface provides the ability to specify additional parameters in the form of name value pairs.

See Also:
  • Method Summary

    Modifier and Type
    Method
    Description
    Retrieves a URI to the file's binary.
    <T> T
    getParameter(String parameterName, Class<T> clazz)
    Retrieves one of the file's parameters by name.
    <T> T
    getParameter(String parameterName, T defaultValue)
    Retrieves one of the file's parameters by name.
    Retrieves the names of all parameters included in the file.
    Retrieves the size of the file, in bytes.
  • Method Details

    • getSize

      Optional<Long> getSize()
      Retrieves the size of the file, in bytes.
      Returns:
      Byte size.
    • getBinaryURI

      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(String parameterName, 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(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

      String[] getParameterNames()
      Retrieves the names of all parameters included in the file.
      Returns:
      Parameter names.