Here are the examples of the java api class com.google.appengine.tools.cloudstorage.GcsOutputChannel taken from open source projects.
1. CloudFileManager#createOrUpdate()
Project: iosched
File: CloudFileManager.java
File: CloudFileManager.java
/** * Create or update a file in a GCC bucket, using the default ACL for the bucket. * * @param filename Name of file to create * @param contents File contents * @param shortCache If true, sets cache expiry to 0 sec. Otherwise, cache expiry is set to 6,000 sec. * @throws IOException */ public void createOrUpdate(String filename, JsonElement contents, boolean shortCache) throws IOException { GcsFilename file = new GcsFilename(defaultBucket, filename); GcsFileOptions options = new GcsFileOptions.Builder().mimeType("application/json").cacheControl("public, max-age=" + (shortCache ? 0 : 6000)).build(); GcsOutputChannel writeChannel = null; try { writeChannel = gcsService.createOrReplace(file, options); Writer writer = Channels.newWriter(writeChannel, DEFAULT_CHARSET_NAME); new Gson().toJson(contents, writer); writer.flush(); } finally { if (writeChannel != null) { writeChannel.close(); } } }