Class Image
- java.lang.Object
-
- org.schabi.newpipe.extractor.Image
-
- All Implemented Interfaces:
java.io.Serializable
public final class Image extends java.lang.Object implements java.io.SerializableClass 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_UNKNOWNandWIDTH_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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classImage.ResolutionLevelThe estimated resolution level of anImage.
-
Field Summary
Fields Modifier and Type Field Description static intHEIGHT_UNKNOWNConstant representing that the height of anImageis unknown.static intWIDTH_UNKNOWNConstant representing that the width of anImageis unknown.
-
Constructor Summary
Constructors Constructor Description Image(java.lang.String url, int height, int width, Image.ResolutionLevel estimatedResolutionLevel)Construct anImageinstance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Image.ResolutionLevelgetEstimatedResolutionLevel()Get the estimated resolution level of this image.intgetHeight()Get the height of thisImage.java.lang.StringgetUrl()Get the URL of thisImage.intgetWidth()Get the width of thisImage.java.lang.StringtoString()Get a string representation of thisImageinstance.
-
-
-
Field Detail
-
HEIGHT_UNKNOWN
public static final int HEIGHT_UNKNOWN
Constant representing that the height of anImageis unknown.- See Also:
- Constant Field Values
-
WIDTH_UNKNOWN
public static final int WIDTH_UNKNOWN
Constant representing that the width of anImageis 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.NullPointerExceptionConstruct anImageinstance.- Parameters:
url- the URL to the image, which should be not null or emptyheight- the image's heightwidth- the image's widthestimatedResolutionLevel- the image's estimated resolution level, which must not be null- Throws:
java.lang.NullPointerException- ifestimatedResolutionLevelis null
-
-
Method Detail
-
getUrl
@Nonnull public java.lang.String getUrl()
Get the URL of thisImage.- Returns:
- the
Image's URL.
-
getHeight
public int getHeight()
Get the height of thisImage.If it is unknown,
HEIGHT_UNKNOWNis returned instead.- Returns:
- the
Image's height orHEIGHT_UNKNOWN
-
getWidth
public int getWidth()
Get the width of thisImage.If it is unknown,
WIDTH_UNKNOWNis returned instead.- Returns:
- the
Image's width orWIDTH_UNKNOWN
-
getEstimatedResolutionLevel
@Nonnull public Image.ResolutionLevel getEstimatedResolutionLevel()
Get the estimated resolution level of this image.If it is unknown,
Image.ResolutionLevel.UNKNOWNis returned instead.- Returns:
- the estimated resolution level, which is never
null - See Also:
Image.ResolutionLevel
-
toString
@Nonnull public java.lang.String toString()
Get a string representation of thisImageinstance.The representation will be in the following format, where
url,height,widthandestimatedResolutionLevelrepresent the corresponding properties:
Image {url=url, height='height, width=width, estimatedResolutionLevel=estimatedResolutionLevel}'- Overrides:
toStringin classjava.lang.Object- Returns:
- a string representation of this
Imageinstance
-
-