@Test public void retrieveResourceAsInputStreamAbsolutePathTest() throws IOException { String fileName = "retrieveStyleSheetTest.css"; String absolutePath = Paths.get(baseUri, fileName).toFile().getAbsolutePath(); ResourceResolver resourceResolver = new ResourceResolver(baseUri); try (InputStream stream = resourceResolver.retrieveResourceAsInputStream(absolutePath); InputStream expected = new FileInputStream(absolutePath);) { Assert.assertNotNull(stream); Assert.assertEquals(expected.read(), stream.read()); } }
public InputStream retrieveResourceAsInputStream(String src) { byte[] bytes = retrieveBytesFromBase64Src(src); if (bytes != null) { return new ByteArrayInputStream(bytes); } try { URL url = uriResolver.resolveAgainstBaseUri(src); return retriever.getInputStreamByUrl(url); } catch (Exception e) { logger.error(MessageFormatUtil.format(LogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI, uriResolver.getBaseUri(), src), e); return null; } }
ResourceResolver { public InputStream retrieveResourceAsInputStream(String src) { byte[] bytes = retrieveBytesFromBase64Src(src); if (bytes != null) { return new ByteArrayInputStream(bytes); } try { URL url = uriResolver.resolveAgainstBaseUri(src); return retriever.getInputStreamByUrl(url); } catch (Exception e) { logger.error(MessageFormatUtil.format(LogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI, uriResolver.getBaseUri(), src), e); return null; } } }
ResourceResolver { public InputStream retrieveResourceAsInputStream(String src) { byte[] bytes = retrieveBytesFromBase64Src(src); if (bytes != null) { return new ByteArrayInputStream(bytes); } try { URL url = uriResolver.resolveAgainstBaseUri(src); return retriever.getInputStreamByUrl(url); } catch (Exception e) { logger.error(MessageFormatUtil.format(LogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI, uriResolver.getBaseUri(), src), e); return null; } } ResourceResolver(String baseUri);  ResourceResolver(String baseUri, IResourceRetriever retriever); }
ResourceResolver { public InputStream retrieveResourceAsInputStream(String src) { byte[] bytes = retrieveBytesFromBase64Src(src); if (bytes != null) { return new ByteArrayInputStream(bytes); } try { URL url = uriResolver.resolveAgainstBaseUri(src); return retriever.getInputStreamByUrl(url); } catch (Exception e) { logger.error(MessageFormatUtil.format(LogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI, uriResolver.getBaseUri(), src), e); return null; } } ResourceResolver(String baseUri);  ResourceResolver(String baseUri, IResourceRetriever retriever); IResourceRetriever getRetriever(); ResourceResolver setRetriever(IResourceRetriever retriever); @Deprecated PdfImageXObject retrieveImage(String src); PdfXObject retrieveImageExtended(String src); @Deprecated InputStream retrieveStyleSheet(String uri); @Deprecated byte[] retrieveStream(String src); byte[] retrieveBytesFromResource(String src); InputStream retrieveResourceAsInputStream(String src); boolean isDataSrc(String src); URL resolveAgainstBaseUri(String uri); void resetCache(); @Deprecated boolean isImageTypeSupportedByImageDataFactory(String src); }
ResourceResolver { public InputStream retrieveResourceAsInputStream(String src) { byte[] bytes = retrieveBytesFromBase64Src(src); if (bytes != null) { return new ByteArrayInputStream(bytes); } try { URL url = uriResolver.resolveAgainstBaseUri(src); return retriever.getInputStreamByUrl(url); } catch (Exception e) { logger.error(MessageFormatUtil.format(LogMessageConstant.UNABLE_TO_RETRIEVE_STREAM_WITH_GIVEN_BASE_URI, uriResolver.getBaseUri(), src), e); return null; } } ResourceResolver(String baseUri);  ResourceResolver(String baseUri, IResourceRetriever retriever); IResourceRetriever getRetriever(); ResourceResolver setRetriever(IResourceRetriever retriever); @Deprecated PdfImageXObject retrieveImage(String src); PdfXObject retrieveImageExtended(String src); @Deprecated InputStream retrieveStyleSheet(String uri); @Deprecated byte[] retrieveStream(String src); byte[] retrieveBytesFromResource(String src); InputStream retrieveResourceAsInputStream(String src); boolean isDataSrc(String src); URL resolveAgainstBaseUri(String uri); void resetCache(); @Deprecated boolean isImageTypeSupportedByImageDataFactory(String src); static final String BASE64IDENTIFIER; static final String DATA_SCHEMA_PREFIX; }