java.lang.NullPointerException after reading file as InputStream from AssetManager
<p>AssetManager defination and use:    </p>

<pre><code>...
AssetManager mngr = getAssets();
try{
      encrypter.decrypt(mngr.open("sample.txt"),output_file);
}...(continued)
</code></pre>

<p>decrypt function:</p>

<pre><code>public void decrypt(InputStream in, OutputStream out)
    {
            try
            {
                    // Bytes read from in will be decrypted
                    in = new CipherInputStream(in, dcipher);
                    // Read in the decrypted bytes and write the cleartext to out
                    int numRead = 0;
                    while ((numRead = in.read(buf)) &gt;= 0)
                    {
                      out.write(buf, 0, numRead);
                    }
                    out.close();
            ...(continued)
</code></pre>

<p>Its giving error for line <strong>out.write(buf, 0, numRead);</strong> as java.lang.NullPointerException. </p>

<p>This call was working fine when used as:</p>

<p>*encrypter.decrypt(new FileInputStream("sample.txt"),output_file)* (i.e. when reading file from local than assets directory of android); </p>

<p>Any reasons why?</p>

<p>Any help is appreciated! Thanks!</p>
