title: How can I get the number of bytes availables with Xamarin Android
body: <p>I want to use <a href="https://developer.xamarin.com/api/member/Java.IO.InputStream.Available()/" rel="nofollow noreferrer">this method</a> in order to get an estimated number of bytes that can be read in a JsonFile from the Asset.</p>
  <p>For that I wrote this code:</p>
  <pre><code>  string filename;
    Stream  mf =  Context.Assets.Open(filename);
  </code></pre>
  <p>The problem is that I cannot have mf as an InputStream because Context.Assets.Open(filename); gives a System.IO.Stream.</p>
  <p>And I need to define mf as an InputStream in order to be able to have the size such as:</p>
  <pre><code>int size= mf.Available();
  </code></pre>
  <p>I tried also:</p>
  <pre><code>InputStream  mf = AssetManager.Open(filename);
  </code></pre>
  <p>But I have the error of &quot;
  An object reference is required for the property , method, or the non-static field  &quot;AssetManager.Open&quot;&quot;</p>
  <p>How can I get over this conflict?</p>