Class Image

  • All Implemented Interfaces:
    java.io.Serializable

    public final class Image
    extends java.lang.Object
    implements java.io.Serializable
    Class representing images in the extractor.

    An image has four properties: its URL, its height, its width and its estimated quality level.

    Depending of the services, the height, the width or both properties may be not known. Implementations must use the relevant unknown constants in this case (HEIGHT_UNKNOWN and WIDTH_UNKNOWN), to ensure properly the lack of knowledge of one or both of these properties to extractor clients.

    They should also respect the ranges defined in the estimated image resolution levels as much as possible, to ensure consistency to extractor clients.

    See Also:
    Serialized Form
    • Field Detail

      • HEIGHT_UNKNOWN

        public static final int HEIGHT_UNKNOWN
        Constant representing that the height of an Image is unknown.
        See Also:
        Constant Field Values
      • WIDTH_UNKNOWN

        public static final int WIDTH_UNKNOWN
        Constant representing that the width of an Image is unknown.
        See Also:
        Constant Field Values
    • Constructor Detail

      • Image

        public Image​(@Nonnull
                     java.lang.String url,
                     int height,
                     int width,
                     @Nonnull
                     Image.ResolutionLevel estimatedResolutionLevel)
              throws java.lang.NullPointerException
        Construct an Image instance.
        Parameters:
        url - the URL to the image, which should be not null or empty
        height - the image's height
        width - the image's width
        estimatedResolutionLevel - the image's estimated resolution level, which must not be null
        Throws:
        java.lang.NullPointerException - if estimatedResolutionLevel is null
    • Method Detail

      • getUrl

        @Nonnull
        public java.lang.String getUrl()
        Get the URL of this Image.
        Returns:
        the Image's URL.
      • toString

        @Nonnull
        public java.lang.String toString()
        Get a string representation of this Image instance.

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

        Image {url=url, height='height, width=width, estimatedResolutionLevel=estimatedResolutionLevel}'

        Overrides:
        toString in class java.lang.Object
        Returns:
        a string representation of this Image instance