protected InputStream getBundleInputStream(Resource resource, Map<String, StreamProvider> providers) throws IOException {
String uri = getUri(resource);
if (uri == null) {
throw new IllegalStateException("Resource has no uri");
}
StreamProvider provider = providers.get(uri);
if (provider == null) {
throw new IllegalStateException("Resource " + uri + " has no StreamProvider");
}
return provider.open();
}