Repository: jclouds-examples
Updated Branches:
  refs/heads/master a280fcf73 -> cf2da297e


Prefer ByteSource over String Payload


Project: http://git-wip-us.apache.org/repos/asf/jclouds-examples/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds-examples/commit/4fbeefdb
Tree: http://git-wip-us.apache.org/repos/asf/jclouds-examples/tree/4fbeefdb
Diff: http://git-wip-us.apache.org/repos/asf/jclouds-examples/diff/4fbeefdb

Branch: refs/heads/master
Commit: 4fbeefdbdf061d996b3e10bd0bbe1e6423fa12fa
Parents: a280fcf
Author: Andrew Gaul <[email protected]>
Authored: Thu Apr 10 16:20:08 2014 -0700
Committer: Andrew Gaul <[email protected]>
Committed: Thu Apr 10 16:20:08 2014 -0700

----------------------------------------------------------------------
 .../java/org/jclouds/examples/blobstore/basics/MainApp.java | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds-examples/blob/4fbeefdb/blobstore-basics/src/main/java/org/jclouds/examples/blobstore/basics/MainApp.java
----------------------------------------------------------------------
diff --git 
a/blobstore-basics/src/main/java/org/jclouds/examples/blobstore/basics/MainApp.java
 
b/blobstore-basics/src/main/java/org/jclouds/examples/blobstore/basics/MainApp.java
index 42fe96a..1486d6a 100755
--- 
a/blobstore-basics/src/main/java/org/jclouds/examples/blobstore/basics/MainApp.java
+++ 
b/blobstore-basics/src/main/java/org/jclouds/examples/blobstore/basics/MainApp.java
@@ -43,9 +43,11 @@ import org.jclouds.rest.RestContext;
 import org.jclouds.s3.S3AsyncClient;
 import org.jclouds.s3.S3Client;
 
+import com.google.common.base.Charsets;
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;
 import com.google.common.collect.Maps;
+import com.google.common.io.ByteSource;
 import com.google.inject.Module;
 
 /**
@@ -95,9 +97,14 @@ public class MainApp {
          // Create Container
          BlobStore blobStore = context.getBlobStore();
          blobStore.createContainerInLocation(null, containerName);
+         String blobName = "test";
+         ByteSource payload = 
ByteSource.wrap("testdata".getBytes(Charsets.UTF_8));
 
          // Add Blob
-         Blob blob = blobStore.blobBuilder("test").payload("testdata").build();
+         Blob blob = blobStore.blobBuilder(blobName)
+            .payload(payload)
+            .contentLength(payload.size())
+            .build();
          blobStore.putBlob(containerName, blob);
 
          // List Container

Reply via email to