title: Fastest way of storing images to external storage
body: <p>I'm using <code>Bitmap.compres(...)</code>, but I have to decode a bunch of bitmaps for that using BitmapFactory which takes a lot of time. I want to skip that decoding, if it is possible, in any way that I can make it faster. Is there a way of doing that and how? </p>
  
  <pre class="lang-java prettyprint-override"><code>for (int i = 0; i &lt; inAssets.length; i++) {
                  try {
                      inAssetsFolder = assetManager.list("");
                      toWrite = new File(pathToFile);
                      toWrite.mkdir();
                      for (int j = 0; j &lt; inAssetsFolder.length; j++) {
                          inputStream = assetManager.open(inAssetsFolder[j]);
                          bmp = BitmapFactory.decodeStream(inputStream);
                          image = new File(toWrite.getAbsolutePath(),inAssetsFolder[j]);
                          fileOutputStream = new FileOutputStream(image);
                          bmp.compress(Bitmap.CompressFormat.PNG, 100, fileOutputStream);
                          fileOutputStream.flush();
                          fileOutputStream.close();
                      }
                  } catch (IOException ex) {
                      ex.printStackTrace();
              }
          }
  </code></pre>