Class ImageSuffix

java.lang.Object
org.schabi.newpipe.extractor.utils.ImageSuffix
All Implemented Interfaces:
Serializable

public final class ImageSuffix extends Object implements Serializable
Serializable class representing a suffix (which may include its format extension, such as .jpg) which needs to be added to get an image/thumbnail URL with its corresponding height, width and estimated resolution level.

This class is used to construct Image instances from a single base URL/path, in order to get all or most image resolutions provided, depending on the service and the resolutions provided.

Note that this class is not intended to be used externally and so should only be used when interfacing with the extractor.

See Also:
  • Constructor Details

    • ImageSuffix

      public ImageSuffix(@Nonnull String suffix, int height, int width, @Nonnull Image.ResolutionLevel estimatedResolutionLevel) throws NullPointerException
      Create a new ImageSuffix instance.
      Parameters:
      suffix - the suffix string
      height - the height corresponding to the image suffix
      width - the width corresponding to the image suffix
      estimatedResolutionLevel - the Image.ResolutionLevel of the image suffix, which must not be null
      Throws:
      NullPointerException - if estimatedResolutionLevel is null
  • Method Details

    • getSuffix

      @Nonnull public String getSuffix()
      Returns:
      the suffix which needs to be appended to get the full image URL
    • getHeight

      public int getHeight()
      Returns:
      the height corresponding to the image suffix, which may be unknown
    • getWidth

      public int getWidth()
      Returns:
      the width corresponding to the image suffix, which may be unknown
    • getResolutionLevel

      @Nonnull public Image.ResolutionLevel getResolutionLevel()
      Returns:
      the estimated Image.ResolutionLevel of the suffix, which is never null.
    • toString

      @Nonnull public String toString()
      Get a string representation of this ImageSuffix instance.

      The representation will be in the following format, where suffix, height, width and resolutionLevel represent the corresponding properties:

      ImageSuffix {url=url, height=height, width=width, resolutionLevel=resolutionLevel}'

      Overrides:
      toString in class Object
      Returns:
      a string representation of this ImageSuffix instance