use of org.apache.xmlgraphics.io.ResourceResolver in project grafikon by jub77.
the class PdfTransformer method convertResolver.
private static ResourceResolver convertResolver(URIResolver uriResolver) {
return new ResourceResolver() {
@Override
public Resource getResource(URI uri) throws IOException {
String asciiUri = uri.toASCIIString();
InputStream is = PdfTransformer.class.getClassLoader().getResourceAsStream(asciiUri);
if (is == null && uriResolver != null) {
try {
StreamSource streamSource = (StreamSource) uriResolver.resolve(asciiUri, null);
if (streamSource != null) {
is = streamSource.getInputStream();
}
} catch (TransformerException e) {
throw new IOException(e);
}
}
return is == null ? null : new Resource(is);
}
@Override
public OutputStream getOutputStream(URI uri) throws IOException {
return null;
}
};
}
Aggregations