public void analyse(Collection<URI> sheetURIs, Collection<String> embeddedCSS, URI embedContainerURI, NetworkProcessor network) throws IOException, URISyntaxException, CSSException { if (!SupportedCSS.isSupportedMedia(Medium)) { throw new IllegalStateException("medium '" + Medium + "' is not supported"); } List<URI> alluris = new ArrayList<URI>(); List<String> csscode = new ArrayList<String>(embeddedCSS); for (int k = 0; k < embeddedCSS.size(); ++k) alluris.add(embedContainerURI); for (URI uri : sheetURIs) { if (uri != null) { alluris.add(uri); csscode.add(IOUtils.toString(uri.toURL().openStream(), "UTF-8")); } } List<StyleSheet> styleSheets = new ArrayList<StyleSheet>(); for (int k = 0; k < csscode.size(); ++k) { String basePath = alluris.get(k).resolve(".").toString(); String withAbsURL = makeURLabsolute(csscode.get(k), basePath); styleSheets.add(parserFactory.parse(withAbsURL, network, null, SourceType.EMBEDDED, new URL("http://base"))); /* * we cannot use CSSFactory.parse(withAbsURL) because it tries to * convert the null base URL into a String */ } mAnalyzer = new Analyzer(styleSheets); }
if(css.isSupportedMedia(m)) affected.add(m);
if(css.isSupportedMedia(mText)) media.append(mText); else if(css.isSupportedMedia(mText)) media.append(",").append(mText); else