vishesh
vishesh

Reputation: 2045

parse csv file in gaej using blobstore

I have uploaded a csv file to blobstore using blobstoreService.now how can i parse this csv file using blobkey.that is how I read this file in a inputstream kind of thing

Upvotes: 0

Views: 900

Answers (1)

Pau Kiat Wee
Pau Kiat Wee

Reputation: 9505

You can get the file InputStream via BlobKey(String blobKey) as constructor parameter to BlobstoreInputStream(BlobKey blobKey).

For example:

BlobstoreInputStream is = new BlobstoreInputStream(new BlobKey("YOU_BLOB_KEY"));

For parsing CSV file, you can consider use opencsv's CSVReader.

For example:

CSVReader csvReader = new CSVReader(new InputStreamReader(is));
List<String[]> rows = csvReader.readAll();

Upvotes: 1

Related Questions