}
@Override
public InputStream getInputStream() throws IOException {
try {
BlobStore blobStore = ServiceHelper.getService(id, providerOrApi, blobStores);
if (blobStore == null && url.getUserInfo() != null) {
String userInfo = url.getUserInfo();
String[] ui = userInfo.split(":");
if (ui != null && ui.length == 2) {
String identity = ui[0];
String credential = ui[1];
blobStore = createBlobStore(providerOrApi, identity, credential, new LinkedHashSet<Module>(), new Properties());
blobStores.add(blobStore);
}
}
if (blobStore == null) {
throw new IOException("BlobStore service not available for provider " + providerOrApi);
}
if (!blobStore.containerExists(containerName)) {
throw new IOException("Container " + containerName + " does not exists");
} else if (!blobStore.blobExists(containerName, blobName)) {
throw new IOException("Blob " + blobName + " does not exists");
}
Blob blob = blobStore.getBlob(containerName, blobName);
return blob.getPayload().getInput();
} catch (Exception e) {
throw (IOException) new IOException("Error opening blob protocol url").initCause(e);
}