Package com.adobe.epubcheck.util
Class SourceSet
- java.lang.Object
-
- com.adobe.epubcheck.util.SourceSet
-
public final class SourceSet extends java.lang.ObjectRepresents an image source set. See https://html.spec.whatwg.org/#source-set
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classSourceSet.Builderstatic interfaceSourceSet.ErrorHandlerAn error handler for the `srcset` parserstatic classSourceSet.ImageSourceRepresent an image source.static classSourceSet.ParseErrorCodes for the various parsing errors.private static classSourceSet.ParserThe `srcser` parser implementation.
-
Field Summary
Fields Modifier and Type Field Description private static com.google.common.base.Function<SourceSet.ImageSource,java.lang.String>LIST_TO_URL_FUNCprivate java.lang.Stringsizeprivate java.util.List<SourceSet.ImageSource>sourcesprivate java.util.List<java.lang.String>urls
-
Constructor Summary
Constructors Modifier Constructor Description privateSourceSet(java.util.List<SourceSet.ImageSource> sources, java.lang.String size)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<SourceSet.ImageSource>getImageSources()java.util.List<java.lang.String>getImageURLs()java.lang.StringgetSourceSize()booleanisEmpty()static SourceSetparse(java.lang.String srcset)Parses a `srcset` value and swallows the errors.static SourceSetparse(java.lang.String srcset, SourceSet.ErrorHandler errorHandler)Parses a `srcset` value and reports the errors to the givenSourceSet.ErrorHandler.
-
-
-
Field Detail
-
LIST_TO_URL_FUNC
private static final com.google.common.base.Function<SourceSet.ImageSource,java.lang.String> LIST_TO_URL_FUNC
-
sources
private final java.util.List<SourceSet.ImageSource> sources
-
urls
private final java.util.List<java.lang.String> urls
-
size
private final java.lang.String size
-
-
Constructor Detail
-
SourceSet
private SourceSet(java.util.List<SourceSet.ImageSource> sources, java.lang.String size)
-
-
Method Detail
-
parse
public static SourceSet parse(java.lang.String srcset)
Parses a `srcset` value and swallows the errors. See https://html.spec.whatwg.org/#parsing-a-srcset-attribute
-
parse
public static SourceSet parse(java.lang.String srcset, SourceSet.ErrorHandler errorHandler)
Parses a `srcset` value and reports the errors to the givenSourceSet.ErrorHandler.
-
getImageSources
public java.util.List<SourceSet.ImageSource> getImageSources()
- Returns:
- the list of image sources in the source set.
-
getImageURLs
public java.util.List<java.lang.String> getImageURLs()
- Returns:
- the list of the URLs of the images sources in the source set.
-
getSourceSize
public java.lang.String getSourceSize()
- Returns:
- the number of sources in this source set.
-
isEmpty
public boolean isEmpty()
- Returns:
- whether this source set is empty.
-
-