DecodeStream throwing null while storing in bitmap
<p>This is my code... I am getting exception NULL  at <code>imageBitmap = BitmapFactory.decodeStream(is2,null, options);</code></p>

<p>First time it can decode but why now, decodeStream throwing null ?</p>

<pre><code> public void showImageThumb(FileInputStream is)
        {
            final int IMAGE_MAX_SIZE = 100;
            FileInputStream is2 = is;
            BitmapFactory.Options options=new BitmapFactory.Options();
            options.inSampleSize = 4;
            Bitmap imageBitmap = BitmapFactory.decodeStream(is,null, options);
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            int height = options.outHeight;
            int width = options.outWidth;
            int scale = 1;
            if ( height &gt; IMAGE_MAX_SIZE || width &gt; IMAGE_MAX_SIZE) 
            {
                 scale = (int)Math.pow(2, (int) Math.round(Math.log(IMAGE_MAX_SIZE / (double) Math.max(options.outHeight, options.outWidth)) / Math.log(0.5)));
            }
            try {
                is.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            options = new BitmapFactory.Options();
            options.inSampleSize = scale*2;
            imageBitmap = BitmapFactory.decodeStream(is2,null, options);
            height = options.outHeight;
            width = options.outWidth;
            imageBitmap.compress(Bitmap.CompressFormat.JPEG, 100, baos); //ERROR HERE 
            imageSelectedThumb = baos.toByteArray();
</code></pre>
