title: Get Google Cloud Storage File from ObjectName
body: <p>I'm migrating my GAE app from the deprecated File API to Google Cloud Storage Client Library. 
  I used to persist the blobKey, but since there is partial support for it (as specified <a href="https://cloud.google.com/appengine/docs/java/blobstore/" rel="nofollow">here</a>) from now on I'll have to persist the object name.
  Unfortunately the object name that comes from the GCS looks more or less like this</p>
  
  <blockquote>
    <p>/gs/bucketname/819892hjd81dh19gf872g8211</p>
  </blockquote>
  
  <p>as you can see, it also contains the bucket name</p>
  
  <p>Here's the issue, every time I need to get the file for further processing (or to serve it in a servlet) I need to create an instance of GcsFileName(bucketName, objectName) which gives me something like </p>
  
  <blockquote>
    <p>/bucketName/gs/bucketName/akahsdjahslagfasgfjkasd</p>
  </blockquote>
  
  <p>which (of course) doesn't work.</p>
  
  <p>so. my question is:
   - how can I generate a GcsFileName form the objectName?</p>
  
  <p>UPDATE</p>
  
  <p>I tried using the objectName as BlobKey. But it just doesn't work :(</p>
  
  <pre><code>InputStream is = new BlobstoreInputStream(blobstoreService.createGsBlobKey("/gs/bucketName/akahsdjahslagfasgfjkasd"));
  </code></pre>
  
  <p>I got the usual answer</p>
  
  <blockquote>
    <p>BlobstoreInputStream received an invalid blob key</p>
  </blockquote>
  
  <p>How do I get the file using the ObjectName???</p>