Created
May 15, 2014 12:54
-
-
Save bogdan-nourescu/7f52a07efeb1707ce971 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static void writeFile(GcsFilename gcsFileName, String content, String contentType) { | |
try { | |
GcsFileOptions options = new GcsFileOptions.Builder().mimeType(contentType).contentEncoding("UTF-8").build(); | |
GcsService gcsService = GcsServiceFactory.createGcsService(); | |
GcsOutputChannel writeChannel; | |
writeChannel = gcsService.createOrReplace(gcsFileName, options); | |
writeChannel.write(ByteBuffer.wrap(content.getBytes("UTF-8"))); | |
writeChannel.close(); | |
} catch (IOException e) { | |
Log.w(e); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment