BlobStoreContext context = new BlobStoreContextFactory().createContext(provider, MODULES, overrides);
try {
long start = System.currentTimeMillis();
// Create Container
AsyncBlobStore blobStore = context.getAsyncBlobStore(); // it can be changed to sync
// BlobStore
ListenableFuture<Boolean> future = blobStore.createContainerInLocation(null, containerName);
future.get();
File input = new File(fileName);
long length = input.length();
// Add a Blob
Blob blob = blobStore.blobBuilder(objectName).payload(input)
.contentType(MediaType.APPLICATION_OCTET_STREAM).contentDisposition(objectName).build();
// Upload a file
ListenableFuture<String> futureETag = blobStore.putBlob(containerName, blob, multipart());
// asynchronously wait for the upload
String eTag = futureETag.get();
printSpeed("Sucessfully uploaded eTag(" + eTag + ")", start, length);