/** * @return Returns null if uri could not be loaded */ private Stylesheet parse(StylesheetInfo info) { CSSResource cr = _userAgentCallback.getCSSResource(info.getUri()); // Whether by accident or design, InputStream will never be null // since the null resource stream is wrapped in a BufferedInputStream InputStream is = cr.getResourceInputSource().getByteStream(); try { return parse(new InputStreamReader(is, "UTF-8"), info); } catch (UnsupportedEncodingException e) { // Shouldn't happen throw new RuntimeException(e.getMessage(), e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { // ignore } } } }
/** * @return Returns null if uri could not be loaded */ private Stylesheet parse(StylesheetInfo info) { CSSResource cr = _userAgentCallback.getCSSResource(info.getUri()); // Whether by accident or design, InputStream will never be null // since the null resource stream is wrapped in a BufferedInputStream InputStream is = cr.getResourceInputSource().getByteStream(); try { return parse(new InputStreamReader(is, "UTF-8"), info); } catch (UnsupportedEncodingException e) { // Shouldn't happen throw new RuntimeException(e.getMessage(), e); } finally { if (is != null) { try { is.close(); } catch (IOException e) { // ignore } } } }
final CSSResource cssResource = cssResources.get( uri ) ; if( cssResource == null ) { return defaultAgentCallback.getCSSResource( uriAsString ) ; } else { return cssResource ;