title: IOException when reading AssetFileDescriptor
body: <p>I'm trying to read a bitmap from the Android <code>/assets</code> folder using the following code:</p>
  
  <pre><code>AssetFileDescriptor fd = getAssets().openFd("pic1.jpg")
  Bitmap bitmap = BitmapFactory.decodeFileDescriptor(fd.getFileDescriptor());
  </code></pre>
  
  <p>The exception I'm getting suggests that the file permissions are wrong:</p>
  
  <pre><code>java.io.IOException: read failed: EBADF (Bad file number)
      at libcore.io.IoBridge.read(IoBridge.java:432)
      at java.io.FileInputStream.read(FileInputStream.java:179)
      at java.io.BufferedInputStream.fillbuf(BufferedInputStream.java:168)
      at java.io.BufferedInputStream.read(BufferedInputStream.java:309)
      at android.graphics.BitmapFactory.nativeDecodeStream(Native Method)
      at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:587)
      at android.graphics.BitmapFactory.decodeFileDescriptor(BitmapFactory.java:670)
      at android.graphics.BitmapFactory.decodeFileDescriptor(BitmapFactory.java:688)
  </code></pre>
  
  <p>Attempting to read it from the input stream yields a similar exception:</p>
  
  <pre><code>AssetFileDescriptor fd = getAssets().openFd("pic1.jpg");
  FileInputStream is = fd.createInputStream();
  Bitmap bitmap = BitmapFactory.decodeStream(is);
  </code></pre>
  
  <p>The exception:</p>
  
  <pre><code>java.io.IOException: lseek failed: EBADF (Bad file number)
  Stack trace:
    at java.io.FileInputStream.skip(FileInputStream.java:197)
    at android.content.res.AssetFileDescriptor$AutoCloseInputStream.&lt;init&gt;(AssetFileDescriptor.java:173)
    at android.content.res.AssetFileDescriptor.createInputStream(AssetFileDescriptor.java:138)
  </code></pre>
  
  <p>Reading directly from the input stream gives yet another exception:</p>
  
  <pre><code>InputStream is = getAssets().open("pic1.jpg");
  Bitmap bitmap = BitmapFactory.decodeStream(is);
  </code></pre>
  
  <p>The exception:</p>
  
  <pre><code>java.lang.NullPointerException: asset
    at android.content.res.AssetManager.seekAsset(Native Method)
    at android.content.res.AssetManager.access$600(AssetManager.java:35)
    at android.content.res.AssetManager$AssetInputStream.mark(AssetManager.java:567)
    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:572)
    at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:643)
  </code></pre>
  
  <p>What's the correct way to read assets?</p>