Skip to content

Commit 6f9e9ff

Browse files
committed
---
yaml --- r: 937 b: refs/heads/master c: abc9a00 h: refs/heads/master i: 935: 7bccad7 v: v3
1 parent 3329225 commit 6f9e9ff

3 files changed

Lines changed: 11 additions & 10 deletions

File tree

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
2-
refs/heads/master: ebfde4b2a0983385f4189d04e18611f4a9f26ee4
2+
refs/heads/master: abc9a0091cea65adf7682c2c31493d5ab0f00d37
33
refs/heads/travis: 0fa997e2fc9c6b61b2d91e6d163655aae67d44b6
44
refs/heads/gh-pages: 5a10432ecc75f29812e33a8236c900379509fe99

trunk/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,27 +102,28 @@ See the ``gcloud-java`` API [storage documentation][storage-api] to learn how to
102102
with the Cloud Storage using this Client Library.
103103

104104
```java
105+
import static java.nio.charset.StandardCharsets.UTF_8;
106+
105107
import com.google.gcloud.storage.Blob;
106108
import com.google.gcloud.storage.Storage;
107109
import com.google.gcloud.storage.StorageFactory;
108110
import com.google.gcloud.storage.StorageOptions;
111+
109112
import java.nio.ByteBuffer;
110113
import java.nio.channels.WritableByteChannel;
111114

112115
StorageOptions options = StorageOptions.builder().projectId(PROJECT_ID).build();
113116
Storage storage = StorageFactory.instance().get(options);
114-
byte[] content = readContent();
115117
Blob blob = new Blob(storage, "bucket", "blob_name");
116118
if (!blob.exists()) {
117-
storage.create(blob.info(), content);
119+
storage2.create(blob.info(), "Hello, Cloud Storage!".getBytes(UTF_8));
118120
} else {
119121
System.out.println("Updating content for " + blob.info().name());
120122
byte[] prevContent = blob.content();
121-
content = mergeContent(prevContent, content);
123+
System.out.println(new String(prevContent, UTF_8));
122124
WritableByteChannel channel = blob.writer();
123-
channel.write(ByteBuffer.wrap(content));
125+
channel.write(ByteBuffer.wrap("Updated content".getBytes(UTF_8)));
124126
channel.close();
125-
}
126127
}
127128
```
128129

trunk/gcloud-java-storage/src/main/java/com/google/gcloud/storage/package-info.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
* <pre>{@code
2222
* StorageOptions options = StorageOptions.builder().projectId("project").build();
2323
* Storage storage = StorageFactory.instance().get(options);
24-
* byte[] content = readContent();
2524
* Blob blob = new Blob(storage, "bucket", "blob_name");
2625
* if (!blob.exists()) {
27-
* storage.create(blob.info(), content);
26+
* storage.create(blob.info(), "Hello, Cloud Storage!".getBytes(UTF_8));
2827
* } else {
28+
* System.out.println("Updating content for " + blob.info().name());
2929
* byte[] prevContent = blob.content();
30-
* content = mergeContent(prevContent, content);
30+
* System.out.println(new String(prevContent, UTF_8));
3131
* WritableByteChannel channel = blob.writer();
32-
* channel.write(ByteBuffer.wrap(content));
32+
* channel.write(ByteBuffer.wrap("Updated content".getBytes(UTF_8)));
3333
* channel.close();
3434
* }}</pre>
3535
*

0 commit comments

Comments
 (0)