public BlobMetadata blobMetadata(String container, String name) { try { StorageObject storageObject = service.getStorageObject(container, name); return generateJcloudsMetadata(storageObject.getMetadata()); } catch (FileNotExistsException e) { e.printStackTrace(); return null; } }
public Blob getBlob(String container, String name) { try { StorageObject storageObject = service.getStorageObject(container, name); Blob blob = new BlobImpl(generateJcloudsMetadata(storageObject.getMetadata())); if (storageObject.getStream() != null) { blob.setPayload(storageObject.getStream()); blob.getMetadata() .getContentMetadata() .setContentLength(storageObject.getMetadata().getLength()); } return blob; } catch (FileNotExistsException e) { e.printStackTrace(); return null; } }