Reputation: 667
I've been searching for java examples or java client libraries to stream out csv content from google blob storage and unfortunately no luck yet except app engine or python ones. We have an application and it uses CharStreams.readLines( ... ) to stream out the data and now that application should be up in compute engine with source data in storage.
Is it possible and if so any documentation?
Upvotes: 1
Views: 695
Reputation: 667
I got perfect examples, actually libraries utilizing guava's bytesource and charsource;
https://github.com/zulily/gcs-buddy/tree/master/src/main/java/gcsbuddy
gcs-buddy An easy-to-use java client for the Google Cloud Storage (GCS) API.
Features
automatic retry on qualifying API errors simplified object and prefix iteration upload/download progress monitoring ability to read objects directly using Guava's ByteSource and CharSource convenience functions for identifying "implicit directories", composing objects, and more
Upvotes: 1
Reputation: 67063
Take a look at the getObjectData
function in the storage sample here:
Instead of using the executeMediaAndDownloadTo
function, use the executeMediaAsInputStream function instead. This will return an InputStream
instance, which you should be able to pass to CharStreams.readLines
.
Upvotes: 1